voidsolve(){ ll n; cin >> n; ll ans = n * (n -1) /2; map<ll, ll>mp;for(inti =1; i <= n; ++i) { ll x; cin >> x; mp[x]++; }for(autox : mp) ans -= x.second * (x.second -1) /2; cout << ans; } D - KAIBUNsyo 在数组A中有n个正整数,给定一种操作: ...
Hey, just a small request... I tried to solve F (https://atcoder.jp/contests/abc206/tasks/abc206_f) by DP. This is what I tried. My understanding for intersecting is, Two intervals A, B are said to intersect if there is atleast one real number x such that x belongs to both A...
AtCoder ABC 206 AB水题,跳过 C - Swappable 在数组中找到满足条件的数对\((i,j)\) \(1 \le i < j \le N (N\in[2,3e5])\) \(A_i \not= A_j\) 一道经典利用map减少搜索规模的题, 先假设每个数互不相同:ans = n * (n - 1) / 2 map存每个数出现的次数,然后减去相同的情况ans -=...
abc206 D - KAIBUNsyo Union Find aising2019 C - Alternating Path Union Find abc256 E - Takahashi's Anguish Union Find, Graph abc216 D - Pair of Balls Topological Sort abc259 D - Circumferences Union Find abc229 E - Graph Destruction Union Find abc218 E - Destruction Union Find abc221...
Last time (ABC355), I reported a suspicious participant toyuzuko who solved problem ABCD in 51 seconds. They also did the similar thing in ABC354. This time (ABC356), there are much more suspicious participants. The average first-AC time (in seconds) of ABC347~ABC353 is in the follow...
AtCoder Beginner Contest 217 D~E 比赛链接:Here ABC水题, D - Cutting Woods 题意:开始一根木棒长度为 \(n\) 并以 \(1\) 为单位在木棒上标记$(1\sim n)$ ,输出 \(q\) 次操作 操作 \(1\) 断开 \(x\) 所在的木棒:\([1,n]\) 在 \(x\) 断开变成了 \([1 ... 割点 时间复杂度 数...
AC代码:https://atcoder.jp/contests/abc300/submissions/41227471 题意: 有多少不大于N的正整数可以表示为a^2×b×c^2,其中三个素数a、b和c,满足a<b<c? 题解: 数论 #include"stdafx.h"#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<vector>#include<stack>usingnamespa...
Search or jump to... Search code, repositories, users, issues, pull requests... Provide feedback We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your...
首先是codeforses,我和一位dalao一起打的,结果考炸了,幸亏不计rating。。 A Alice the Fan 这个就是记忆化搜索一下预处理,然后直接回答询问好了,我肯定是傻逼了,还写了这么长,幸亏调处来了。 #include<cstdio>#include<cstring>#include<algorithm>#include<queue>#include<vector>usingnamespacestd;typedeflong...
ABC270_D.py ABC270_E.py ABC270_F.py ABC270_G.py 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 400 ABC_別解 AGC AHC ARC EDPC OTHERS memo 競プロ典型90題 精選100問 comfused.md readme.mdBreadcrumbs...