Atcoder ABC231 C C - Counting 2 题意 给定n个数,q次查询,每次输出大于等于查询时输入的数的个数。 小知识 lower_bound(大于等于) upper_bound(大于) 返回的是迭代器,相当于STL中的指针 能够和别的函数或者begin(),end()配合 auto it = lower_bound(v.begin(), v.end(), x); 代码 #include <...
ABC231E - Minimal payments 由于Ai−1∣Ai,所以对于一个Ai可以只考虑两种方案:用这个Ai尽可能凑,或者用更大的面值付然后要找零。 usingll=longlong;intn;lla[65],x,ans;unordered_map<ll,unordered_map<ll,ll>>f;lldfs(llx,intnow){if(now==1)returnx;if(f[x][now]>0)returnf[x][now];llr=...
https://atcoder.jp/contests/abc231/editorial/3089 翻译一下它这个官方题解 记期望为 E(X) ,答案是 E(∏i=1n(Xi+Ai)) 由于n 个操作的对称性, n 次选了 n 个位置之后的期望等于将这 n 个位置重排成有序时的期望 n 个乘积项,每项要么取 Ai 要么取 Xi ,展开可得, E(∏i=1n(Xi+Ai))=∑n...
Atcoder:[AGC058D] Yet Another ABC String 洛谷:[AGC058D] Yet Another ABC String Problem 给出\(a,b,c\),求由 \(a\) 个A,\(b\) 个B,\(c\) 个C 构成的字符串数量,使得不存在子串 ABC,BCA 和CAB。\(1 \leq a,b,c \leq 10^6\)。 Solution 可能是 OI 生涯做过最神仙的容斥。 对极...
abc113 C - ID 座標圧縮 abc107 B - Grid Compression 座標圧縮 abc213 C - Reorder Cards 座標圧縮 abc231 F - Jealous Two 座標圧縮, Binary Indexed Tree abc234 D - Prefix K-th Max Heap, Binary Indexed Tree chokudai_S001 J - 転倒数 Binary Indexed Tree abc185 F - Range Xor Query Bin...
yukikotani231 Create README.md Oct 10, 2023 15f009f·Oct 10, 2023 History 6 Commits .cargo chore: cargo compete init Oct 10, 2023 abc322 abc322 a/b/c Oct 10, 2023 .gitignore chore: added gitignore Oct 10, 2023 README.md
サンプルであげたABC231 Cは二分探索で解ける問題ですが、配列で特定の数値以上、以下、未満などを探す処理はよく出るので以下の関数を作っていて、Gif画像内でも実際に使ってます。 // find x of sl[x] < v. return -1 if no lowerbound foundfunclowerBound(vint,sl[]int)int{iflen(sl)=...
Yesterday's ABC at AtCoder was the second successive contest which suffered due to slow servers. Which is fine, I can understand, shit happens. But what actually pissed me off is that the admins didn't even care to announce if the contest is rated or not and ignored messages asking for...
ABC 038 C 単調増加 (しゃくとり法は最大区間・最小区間を求めるだけでなく数え上げにも有効です) ARC 098 D Xor Sum 2 (同じく数え上げにも有効です)【コメント】 高難易度問題において部分的に登場するイメージが強いテクです。 求めるものが「最小の区間」か「最大の区間」かはあま...
E - Minimal paymentsatcoder.jp/contests/abc231/tasks/abc231_e 题意: 这个国家里有 n(n<=60)种货币,每个货币的面值为a[i](a[1]=1,a[i]