题意:给你一个长度为n的数组,从数组中挑选k个元素,使得mex最大。 分析:首先了解mex,mex是一个区间的最小未出现的自然数(包括0),如果一个数组的长度为n,那么mex最多为n。对于本题,我们要求mex的最大值,当…
intr, c; intans = h * w; set<int>::iterator ia, ic; set<int, greater<>>::iterator ib, id; while(q--) { scanf("%d%d", &r, &c); if(T[r].find(c) != T[r].end()) { del(r, c); ans--; }else{ ia = T[r].upper_bound(c); ...
abc294 d,set模拟。 e,两行可以哪行短了放哪行,然后就可以保证多出来部分的只有一种颜色,累加多出来的部分和新加的长度取min f,二分浓度,通过判断浓度大于等于mid来缩小区间,这里进行等价移项,0/1分数规划。 g,一棵树上的两点距离distu +distv -distlca...
For problem C, the editorial say"If the component touches just one digit, the Grundy number is n." I can't really understand how is this true. Can anyone please help me? →Reply purplevine 2 years ago,#^| 0 Wish you have understood it. If not, you can consider the definition of ...
C - AtCoDeer and Election Report题目大意: 有两个比分 TT 和AA,他们一直是增长的,有 NN 个时刻,在第 ii 个时刻你需要保证比分是 Ti:AiTi:Ai,问最终的 T+AT+A 的最小值是多少。解题思路: 这是一道模拟题。其中最需要考虑的地方时如果让比分从这一轮转到下一轮(代码中用 convert(a,b,c,d) 表示...
https://atcoder.jp/contests/abc335/tasks/abc335_c 代码分享 代码语言:javascript 代码运行次数:0 运行 AI代码解释 #include <bits/stdc++.h> using namespace std; const int max_n = 2e5 + 5; struct pos { int x, y; } head[max_n]; void best_coder() { int n, q; cin >> n >> ...
size())) { log = ceil_pow2(_n); size = 1 << log; d = std::vector<S>(2 * size, e()); for (int i = 0; i < _n; i++) d[size + i] = v[i]; for (int i = size - 1; i >= 1; i--) { update(i); } } void set(int p, S x) { assert(0 <= p && ...
For C, we can only move to integer points, so this will not work for any values that aren't perfect squares. → Reply Yianlaen 6 years ago, # | ← Rev. 2 +5 As a junior high student, I think Problem D is unfair because we haven't learnt the arcsin function before the con...
C题 AC代码 #include <bits/stdc++.h> using namespace std; int n, m, k, a[110][110], b[110]; char is_ok[110]; int ans; void check { for (int i = 1; i <= m; i++) { int total = 0; for (int j = 1; j <= a[i][0]; j++) { ...
set 实现 priority queue 实现 10 AtCoder Grand Contest 022 Problem D 10.1 题目背景 AtCoder Grand Contest 022 Problem D 10.2 题目大意 ⼀个车在0 到L 之间来回游荡,速度为1。从0 出发,L, 3L, 5L, . . . 的时间到右端点。0, 2L, 4L, . . . ...