#include<bits/stdc++.h> #define int long long using namespace std; const int INF = 1e18 + 10; int n, X, ans = INF; int a[100]; void dfs(int pos, int sum, int cnt) { if((double)clock()/CLOCKS_PER_SEC >= 1.98) cout << ans << "\n", exit(0); if(cnt >= ans) ...
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 生涯做过最神仙的容斥。 对极...
サンプルであげたABC231 Cは二分探索で解ける問題ですが、配列で特定の数値以上、以下、未満などを探す処理はよく出るので以下の関数を作っていて、Gif画像内でも実際に使ってます。// find x of sl[x] < v. return -1 if no lowerbound found func lowerBound(v int, sl []int) int { if...
AtCoder ABC306E. Best Performances 题解 原题链接中等 作者: Xiongzx , 2023-06-21 08:03:52 , 所有人可见 , 阅读 231 1 E:Best Performances E - Best Performances 本题一共有两种作法。 方法1: 使用权值线段树。 思路:普通线段树的单点修改,找到第 KK 大,然后区间求和即可。 细节: 一个权值...
0 はじめに前回の初級編に続いて、今度は中級編です。プログラミングコンテストチャレンジブック (通称、蟻本) は日本の競技プログラミングの普及に多大な貢献を果たしています。多くの競技プログラマた…
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...
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
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...
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,展开可得, ...