| # | User | Rating |
|---|---|---|
| 1 | Benq | 3857 |
| 2 | jiangly | 3810 |
| 3 | maroonrk | 3534 |
| 4 | tourist | 3528 |
| 5 | Kevin114514 | 3510 |
| 6 | turmax | 3411 |
| 7 | Um_nik | 3387 |
| 8 | Radewoosh | 3367 |
| 9 | heuristica | 3322 |
| 10 | strapple | 3317 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | maspy | 150 |
| 3 | Um_nik | 146 |
| 4 | Errichto | 139 |
| 5 | adamant | 136 |
| 6 | maroonrk | 134 |
| 7 | DNR | 133 |
| 8 | nik_exists | 131 |
| 8 | Dominater069 | 131 |
| 10 | Proof_by_QED | 130 |
|
0
Can anyone finds the runtime error in this code? Thank you! |
|
+3
Thank you! I missed an edge case. |
|
0
Explanation The "natural" array calculates whether a "tests" part of the multitest could start at this location, and if it could, how many tests will the multitest have. The "adapt" array relies on the assumption that the first element of the first test of the multitest could always cover a specific amount of elements, with the rest of the elements being the "tests" part of the multitest itself. Since adapt[i] can always land on any step from i to n, adapt[i] could range from 1 to max(natural[i] to natural[n]) + 1. Therefore: If a[i] is exactly equal to nat[i + 1], a[i] is the start of the multitest already, and we dont need to change anything. If nat[i + 1] is not -1, we just need to change a[i] to nat[i + 1], and the array is sufficient If adapt[i + 1] is greater or equal to a[i], we could always redirect a[i + 1] to a position in which the "tests" part contains a[i] test. If none of the conditions hold, put a[i] to 1 and a[i + 1] to the remaining number of elements will use 2 changes. |
|
0
Anyone knows why my submission for E is wrong? https://codeforces.me/contest/1798/submission/199302004 My algorithm: Spoiler Divide the "multitest" into the "declaration" part of the first number, and the "tests" part from the second number onwards. Create an array "natural" which for each element, natural[i] = -1 if the subarray from i to n cannot be the "tests" part of a multitest; otherwise, natural[i] = k, where k is the number of tests if the subarray from i to n is the "tests" part of a multitest. This can be calculated in O(n). Create an array "adapt", which adapt[i] = 1 if the maximum of "natural" array from i + 1 to n is -1; else, adapt[i] = max of the "natural" array from i + 1 to n. Then, ans[i] = 0 if a[i] = nat[i + 1] ; ans[i] = 1 if nat[i + 1] != -1 or a[i] <= adapt[i]; else ans[i] = 2. |
|
0
Personal take: ImplementationForces sometimes is actually good! Many real-life problem only require brute-force, yet hard solutions. ICPC-style contests also features many implementation-heavy problems. You do not need crazy algorithms or math knowledge to solve C,D, yet the amount of solves are perfect for problems of that level. Stress testing for D to find the exact solution is also a skill we need to have in real-life programming... The problems are also not misleading, so the only person that you can blame if you WA is you, right? |
|
+12
Math knowledge: Sum from 1 to N is N (N + 1) / 2. Modulo knowledge: T (T + 1) mod N = (T + N) (T + N + 1) mod N Therefore, just check I from 1 to N for I * (I + 1) / 2 + X mod N == 0. That's what I thought, but WA on case something... change for from 1 to N to 1 to 2 * N works, but I don't understand how :D |
|
+2
ImplementationForces all the way |
|
0
It's some DP with infinite series I think, got the transitions down but never solved it |
|
0
Hint ...Try to think as a game of probability. At a single node, at any time Hint 2 ... A XOR 0 = A. Combine that with the previous hint about probability to calculate easier! Solution ...For each node, there is a 50% chance that it is 1 on time |
|
+16
Or maybe, still keep rooms, still have infinite hacks, but only give points to the first 3-5 successful hacks? After that, you can still hack, but it will not count toward point total. |
|
0
Weirdly enough, yes! That's why C and D are all 1500 points. This contest's C and D are equal to normal C, and E is equal to (hard) D. |
|
+13
Ignoring the B question (I'm still self-debating whether hacks of this scale is good or not), the contest was really good! Maybe D was a bit too easy (implementation-forces), but E is certainly one of the best tree problem I've done! Thanks a lot to the authors for organizing the contest! |
|
+1
Root the tree at 1. What will you need to do if you want one of the pieces to go to a node with depth that is greater than |
|
+1
facepalm I read the question wrong and thought that a good substring only need the final median to be good... Then I started to look at Pascal triangle and all those stuff... |
|
0
Am I really not seeing something, or is C really addition of nC0 + nC1 + ... + nCk, where k is the amount of '0' or '1' depending on the last digit? If that's the case, how can I calculate it in O(n) or O(n log n)? |
|
0
https://codeforces.me/contest/1771/submission/184787882 Anyone knows why is this wrong at pretest 3? Idea: Check all routes from one leaf to another. I could understand this getting TLE'd, but not WA |
|
0
Just check and factorize every number until sqrt(n). The number remaining would be the remainding prime! |
|
+7
I used sieve for C — worked well within the time limit. |
|
+8
Hint 1 ... How many roads can you make with n nodes of height 1 and m nodes of height 2? Hint 2 ... How many roads can you make with 2 roads of height 1, 4 nodes of height 2, and 3 nodes of height 3? If you need more help just reply! |
|
+8
Very clean code and solution, thank you! I knew that the solution is very clean, but did not have the skill to find it tho. |
|
0
How to solve problem E? The most I can do is a brute force O(n^3) solution. |
|
+17
Factorize N, and then calculate how many numbers between 1 and M are divisible to any of the number factorized using the Inclusion-Exclusion formula: https://www.geeksforgeeks.org/inclusion-exclusion-principle-and-programming-applications/ |
|
+1
Else,we need to find x,which makes a[l]⊕a[l+1]⊕...a[x]==0 and x−l+1 is odd.If such x exists,ans=2.Otherwise,ans=−1 How can you do this in log or smaller time? This is the only part where I got stuck in. |
|
On
steven.novaryo →
Codeforces Round #831 (Div. 1 + Div. 2, based on COMPFEST 14 Final), 4 years ago
0
Oh my god that's literally an one-sentence answer that I've been trying to come up for almost two hours! Thank you! I've got to the part where I thought of the "depth or width" stuff, but I didn't find the general formula for it. |
|
On
steven.novaryo →
Codeforces Round #831 (Div. 1 + Div. 2, based on COMPFEST 14 Final), 4 years ago
0
Anyone know what is pretest 6 in E? This contest is so much WA-in-pretests... |
|
-25
Do-you-know-calculus-forces |
|
0
thanks so much for all the help! I cannot believe how did I miss that either, was the difference between -20 and +80 this contest lol |
|
0
Oh my god why did I miss that... Thank you so much, forgot the initial part of modding the first |
|
0
Thanks for your help! Unfortunately, I still could not find out what went wrong, maybe finishing it tonight tho... |
|
0
I already defined int to be long long so the int stuff should work out normally |
|
0
Sorry for posting the same solution :_: this is the with (m/2)%MOD but still wrong https://codeforces.me/contest/1749/submission/177215823 Do you have any links to learn modular arithmetic in CP so that these problems aren't happening again? Thank you! |
|
0
Thanks for replying! I already tried (m/2)%MOD, but it is still wrong... https://codeforces.me/contest/1749/submission/177211216 There are probably a lot of things wrong in there TwT |
|
+4
To win a game with k turns, the array must have at least k '1', and at least 1 number that is smaller or equal to 2, 3, ..., k. This is because Bob can use a strategy to lock the final move out by adding to each '1' once. Therefore, Bob can lock at most (k-1) '1', so the array must have k '1' to compensate. From there, just search out for the solution! |
|
0
Can someone tell me what is wrong with my modular arithmetic please? https://codeforces.me/contest/1749/submission/177211216 I got the algorithm done with 30 minutes left, then spent the rest of the time trying all combinations and figuring out how my modular arithmetic is wrong... |
| Name |
|---|


