atcoder_official's blog

By atcoder_official, history, 7 weeks ago,

We will hold AtCoder Beginner Contest 352.

We are looking forward to your participation!

• +21

 » 7 weeks ago, # |   -12 Yay, hope to solve E and F.
 » 7 weeks ago, # | ← Rev. 2 →   -17 GL&HF!
 » 7 weeks ago, # |   -20 Good Luck!Hope F!
 » 7 weeks ago, # |   -15 GL&HR!
 » 7 weeks ago, # |   -21 Bad luck and low rating!
•  » » 7 weeks ago, # ^ |   -25 Why bad luck?
•  » » » 7 weeks ago, # ^ |   -24 什么？？？
•  » » » » 5 weeks ago, # ^ |   -11 Please talk in English（请用英语对话）
 » 7 weeks ago, # |   +6 Good luck!- Hope to solve F and G.
•  » » 7 weeks ago, # ^ |   -18 Why were F and G so hard in this contest???
 » 7 weeks ago, # |   -15 Hope to have good luck，and solve F and G! (But I know that's impossible LOL).
 » 7 weeks ago, # |   -15 for problem E , what's the part of my solution that giving a TLE ? is it constructing the graph ??
•  » » 7 weeks ago, # ^ |   -10 Yes. You don't need the whole graph.
•  » » » 7 weeks ago, # ^ |   0 What do you mean by not taking the whole graph? Does it mean omitting to take all edges we get for each K_i and C_i?
•  » » 7 weeks ago, # ^ |   +10 you can use dsu
•  » » 7 weeks ago, # ^ |   -10 You can sort first and not use the whole graph
•  » » 7 weeks ago, # ^ |   +1 I think Sum of K over all M is 10**5 as in the fourth line of the constraints. Constructing a undirected graph will be M squared which is 10**10 which will TLE
•  » » 6 weeks ago, # ^ |   0 I think you can use an algorithm similar to Kruskal's.You shouldn't use an algorithm with $n^2$, that may cost $100$ seconds.
 » 7 weeks ago, # |   -7 I don't understand. Why does my code WA on 4 testcases?
 » 7 weeks ago, # | ← Rev. 3 →   -8 Can anyone help me why I am getting WA on 2 testcases for this solution of F?
•  » » 7 weeks ago, # ^ |   -12 hey aryanc403, Im eagerly waiting for your youtube video discussion. those are great. When will it come today
•  » » » 7 weeks ago, # ^ |   -8 You can find my solution ideas in this linkedin blog
•  » » 7 weeks ago, # ^ | ← Rev. 2 →   +8 I have an AC submission here, you can use this to generate counter tests. https://atcoder.jp/contests/abc352/submissions/53146457
•  » » 7 weeks ago, # ^ |   +8 On line 181 of your latest submission, the return value of this function is a boolean, but you write return ans. While ans here is either tr or fal and both of them are positive integers, so the real return value is always true. I just changed this and got Accepted.
•  » » » 7 weeks ago, # ^ |   0 Nice catch. Thank You.It would have taken me forever to debug this.
 » 7 weeks ago, # | ← Rev. 3 →   0 Does anyone know why I am getting Runtime Error for this submission for D? Is there any issue with the DSU implementation ?https://atcoder.jp/contests/abc352/submissions/53139365
 » 7 weeks ago, # |   +1 what's the idea behind F?
 » 7 weeks ago, # | ← Rev. 3 →   -7 Hello! I'm just a mediocre problem setter who is wondering how to give many many many D&C NTT problems which has almost the same solution quickly. May Atcoder Beginner Contest help? UPD: I don't know whether ironies are just unwelcomed in codeforces or it's not the right place to discuss a problem which has only 143 solves with many newbies? Please, tell me the reason if you decide to downvote me @_@.UPD 2: Maybe next time I'll try "DCNTT in ABC G author's solution, are you retarded?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????".
•  » » 7 weeks ago, # ^ | ← Rev. 3 →   +19 Of coz,ABC is a great way to improve your poly skill quickly. UPD:In fact I agree with wyrqwq's opinion.I think he's not saying that D&C NTT problems are not good,but too many similar D&C NTT problems in ABC are not interesting.
•  » » 7 weeks ago, # ^ |   +40 They are meant to be educational for beginners, as it says in the name. ARCs and AGCs are held to (much) higher standards.
•  » » » 7 weeks ago, # ^ |   0 I think it's not educational to put many tasks with a same algorithm again and again. It's just a sign of lack of responsibility and lack of time to polish a contest.
•  » » 7 weeks ago, # ^ | ← Rev. 2 →   0 probably you don't know that atcoder has acl and you can just call convolution in your solution without knowing what is ntt
•  » » » 7 weeks ago, # ^ |   +5 That is indeed helpful during contest time. But that doesn't help me learn the algorithm itself. Am I just participating in ABC only for getting a higher rank?
•  » » » » 7 weeks ago, # ^ | ← Rev. 2 →   +5 I am trying to understand your frustration. if author's solution used std::set / std::map how much author is retarded?
•  » » » » » 7 weeks ago, # ^ |   -21 Are you saying: if author's solution contains int main() how much author is retarded?
•  » » » » » » 7 weeks ago, # ^ |   0 please no puzzles just answer
•  » » » » » » » 7 weeks ago, # ^ |   -12 Am I not clear? If you don't have the ability to hold a good ABC round every week, hold it every two weeks. If you cannot educate beginners but just keep creating trashes, stop using the name "beginner contest" but "atcoder library contest". If you cannot come up with a different G-placed problem from NTTing, stop posting problems for Atcoder and leave the company. In reply to your question: std::set and std::map are STL containers, and you are sure to learn them long before you understand how a balanced search tree works.
•  » » » » 7 weeks ago, # ^ |   +9 I'd rather agree with unpopular opinion of wyrqwq. I completely don't understand the point of ACL. What is it designed for? I never use it and never will, because I try to improve or at least to keep up my coding skills, first of all. Also, for those who can still participate in official onsite contests, it is really harmful and, I suppose, many of real beginners will suffer from not being able to implement any specific variety of data structure adjusted to specific problem's requirements when they have no access to online resources and ACL. If they need to take a higher place and get more rating, that's completely their choice, although I don't really think it is quite educational. As for the name "AtCoder Beginner Contest", it's really misleading. Despite being not really high-rated lately, I wouldn't call myself a beginner. However on average I solve only 6 problems out of 7. Actually, at least a couple of problems are tricky and educational in almost every round, and they genuinely require a certain effort from me. And normally problem-setters should at least try to avoid similar problem ideas in adjacent contests, which may not be the case for ABC, unfortunately. I think this what wyrqwq meant if to throw away the emotional wording.
 » 7 weeks ago, # |   0 loved F, thank you for contest!
•  » » 7 weeks ago, # ^ |   0 What was the method for F? I was roughly trying to brute force on all non-trivial connected components, (each connected component of size > 1), because I knew 16! would be too slow, but 16 * 8! might pass.
•  » » » 7 weeks ago, # ^ |   +1 Yes, you can actually do brute force, but instead of factorials think about placing components.
 » 7 weeks ago, # |   0 Solved D with a segtreeAll I can see now are segment trees
 » 7 weeks ago, # |   -10 "Yes" != ("YES" || "yes"). LOL, still case sensitive on output strings.
 » 7 weeks ago, # |   0 Randomized solution for F gave me some hope for a moment
•  » » 6 weeks ago, # ^ |   0 what was your solution?
 » 7 weeks ago, # |   0 For E, I forgot to handle this disconnected case: Spoiler4 2 2 7 1 2 2 8 3 4 My submission still gets AC, even though I didn't output -1 for the above case.
 » 7 weeks ago, # |   0 Could someone help me debug E? I've been absolutely confused for the second part of the contest and still can't understand where the WA is coming from: https://atcoder.jp/contests/abc352/submissions/53123170
•  » » 7 weeks ago, # ^ | ← Rev. 2 →   0 brother, iam doing the same, but still waDid you figured it out yet??i looked at Ac code he used vector E(M) and sort it.aren't we doing the same thing using map(which automatically sort by first value)
•  » » 7 weeks ago, # ^ |   0 i think i got why we are failing, because it stores only uniques values there might be some subset having same edges weight but different components, but our map is assuming it's a single components!!
•  » » 7 weeks ago, # ^ | ← Rev. 4 →   0 Fails on following testcase. Spoiler4 2 2 5 1 2 2 5 3 4 Answer is -1 because graph is disconnected. You cannot directly merge all components with same cost.
•  » » » 7 weeks ago, # ^ | ← Rev. 2 →   0 Not sure i got what you mean, my code outputs -1: https://ideone.com/pnCDk1 I only merge when I'm taking a new edge into MST: for (auto &[compCost, conComp]: edges) { int first = conComp[0]; for (auto &vComp: conComp) { if (findSet(first) != findSet(vComp)) { totalCost += compCost; unionSets(first, vComp); } } } 
•  » » » » 7 weeks ago, # ^ |   0 Ah, okay, i finally got it. The test case should probably be 5 2 3 2 1 2 3 2 2 4 5 or smth similar
•  » » » » » 7 weeks ago, # ^ |   +3 Yes. I messed up with input format. https://ideone.com/TYhyXr
•  » » » » » » 7 weeks ago, # ^ |   0 Yeah, looks completely ridiculous i haven't thought about it now. I was so focused on trying to find an error in my Kruskal's implementation i completely overlooked the fact map can merge a couple of cliques together. Thanks for the help!
•  » » » » 7 weeks ago, # ^ |   0 Try this one: Spoiler5 2 2 3 1 2 3 2 3 3 4 5 //this should be 12 
 » 7 weeks ago, # |   0 Good luck !!!
 » 7 weeks ago, # |   0 Speedforces and Speedcoder :)
 » 7 weeks ago, # | ← Rev. 2 →   0 E SubmissionWhat's wrong here? Spoiler#include using namespace std; using ll = long long int; const int N = 2e6 + 10; struct Dsu{ vector parent, rank; ll sz; Dsu(ll n){ sz = n; parent.resize(n+5); rank.resize(n+5, 1); iota(begin(parent), end(parent),0); } vector getparent() {return parent;} vector getrank() {return rank;} ll find(ll x){ if(parent[x] == x) return x; return parent[x] = find(parent[x]); } void Union(ll x, ll y){ x = find(x); y = find(y); if(x != y){ if(rank[x] < rank[y]) swap(x,y); rank[x] += rank[y]; parent[y] = x; } } bool isConnected(ll x, ll y) {return find(x) == find(y);} ll Components(){ ll ans = 0; for(ll i=1;i<=sz;i++) if(find(i) == i) ans++; return ans; } }; int main() { int t; // cin >> t; t = 1; while(t--){ int n, m; cin >> n >> m; map> M; for(ll i = 0; i < m; i++){ ll k, c; cin >> k >> c; for(ll j = 0; j < k; j++){ ll x; cin >> x; M[c].push_back(x); } } Dsu t = Dsu(N); ll sum = 0; for(auto [x, y]: M){ vector cur = y; for(int i = 1; i < cur.size(); i++){ if(!t.isConnected(cur[i - 1], cur[i])){ sum += x; t.Union(cur[i - 1], cur[i]); } } } cout << (t.Components() > 1 ? -1 : sum) << '\n'; } } 
•  » » 7 weeks ago, # ^ | ← Rev. 4 →   +4 Fails on following testcase. Spoiler4 2 2 5 1 2 2 5 3 4 Answer is -1 because graph is disconnected. You cannot directly merge all components with same cost.
•  » » » 7 weeks ago, # ^ |   +5 Thanks, i have figured it out!!
•  » » » » 7 weeks ago, # ^ |   0 Could you help explaining me? I still don't get it
 » 7 weeks ago, # |   +28 When you join the contest late by $5$ minutes and get $F$ accepted after the contest end by $4$ minutes:
 » 7 weeks ago, # |   +1 I would like to share my solution to problem F(taking me about 90 minutes to get accepted), as follows: Divide all the nodes(people) into several connected components, and suppose that there are cnt of them For each component, compute all the feasible rankings, and denote them based on bitmasks Use dp[i][j] to denote that, for the previous i components, whether we can achieve the state of j or not, and also use set last[i][j] to store the previous states that can reach j. Here, the state means the bitmask of rankings The final state should be (1<
•  » » 7 weeks ago, # ^ |   +8 Could you please share the code as well
•  » » » 7 weeks ago, # ^ |   0
 » 7 weeks ago, # |   0 can anyone figure out where i am going wrong in E. https://atcoder.jp/contests/abc352/submissions/53149749
•  » » 7 weeks ago, # ^ |   0 For this test case: Spoiler6 3 2 7 1 2 3 8 3 4 5 3 9 2 3 4 Answer should be -1, because node 6 is not connected. Your code does not output -1.
•  » » » 7 weeks ago, # ^ | ← Rev. 3 →   +3 Figured out was making mistake in finding the leader @llc5pg
 » 7 weeks ago, # |   0 Can anyone give a hint on how to optimize problem E? I did understand the part where we could build a graph from all the given weights (using DSU) and then apply Kruskal to find the MST, but I saw the limits on K and understood this solution would result in TLE.
•  » » 7 weeks ago, # ^ |   0 Try using prims.
•  » » 7 weeks ago, # ^ | ← Rev. 2 →   0 Recognize that some of the edges are redundant and use minimum spanning tree algorithm, kruskal or prims. For example on ignoring redundant edges, you only actually care about joining nodes into the minimum spanning tree if they are disjoint. And you can join all nodes to just a single node representative of a connected component.
•  » » » 7 weeks ago, # ^ |   0 By redundant edges, do you mean multiple edges b/w (u, v)? How are you ignoring the redundant edges? My Approach: For every k_i and c_i, we can sort the k_i vertexes Then, there will be k_i * (k_i — 1) / 2 possible edges (u, v) with c_i weightsIn this k_i alone, we won't be getting any multiple edges, but in subsequent k_i, we can get (but for that also, we must do k_i * (k_i — 1)/2 to check which have been already done or not) Is there any better way to do this ? Above approach will also result in TLE, because there can be atmax N * (N-1) / 2 pairs of (u, v)
 » 7 weeks ago, # |   0 Can someone help me with problem E? Why my code is giving wrong answer on some test cases, even though I have also used the same logic as most others. Submission
 » 7 weeks ago, # |   0 to solve $E$ do I need to learn any algorithm?
•  » » 7 weeks ago, # ^ |   +14 You need two-three topics to solve this problem: The most crucial observation for this problem can be inferred from the listed topics: Spoiler with the idea itselfYou can replace each clique with any spanning tree of it. All edges within a clique have the same weight, so we may just use one of the clique's vertices connected to all other vertices of the clique.
•  » » » 7 weeks ago, # ^ |   +5 thanks for help
•  » » » 4 weeks ago, # ^ |   0 We are connecting all k-1 nodes to one node in a clique. What if we required to connect any two nodes from k-1 nodes?
 » 6 weeks ago, # |   0 The button "Custom" is gone.
 » 6 weeks ago, # |   0 What is the logic behind the question c please also provide me the java code for it
 » 5 weeks ago, # |   +1 this contest was totally fixed and made me bored. abc352 is one of the boring contests ever. abc352 fixing and boring. abc353 is genuine and much interesting with sigma problems.