| # | 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 | Dominater069 | 131 |
| 9 | Proof_by_QED | 130 |
| 9 | AmShZ | 130 |
|
+26
This is correct. For example, let the optimal solution be b1, b2, ..., bi, ..., bn where bi is the minimum. Then consider bi, b1, b2, ..., b_(i-1), b_(i+1), ..., bn. Note that gcd after b_(i+1) is the same so we can ignore the sum of that part. Then if b1 > bi, then we have gcd(bi, b1) <= b1 — bi since gcd(bi, b1)=gcd(bi, b1-bi). Hence in our modified solution, the gcd sequence look like bi, <= b1 — bi, <= gcd(b1, b2), <= gcd(b1, b2, b3), ... and the original look like b1, gcd(b1, b2), gcd(b1, b2, b3) It is clear that sum of our modified sequence is better so taking minimum as first is optimal. For the recursive part we simply reduce the problem by taking gcd(bi, -) with the rest of the numbers. It is clear that this correspond to the subproblem of the sum of the rest of the gcd sequence and the sum is the same. |
|
0
Another reason is that you can't place the array as a global variable in the first approach (as the length has to be known when you declare the array) where you can in the second approach. This can be very convenient when you use functions. |
|
0
The first code make use of variable-length arrays which is not part of the c++ standard. However it is part of the C standard so turns out g++ will also accept the first piece of code. If you're curious why this is the case (that c++ doesn't include variable length array in standard), you can search for "variable length arrays c++" for reasons. Essentially this makes the type of the array no longer known at compile time and doesn't work well with other features in c++. |
|
0
swap the very first 1 and 2 and it become 2 1 2 1 2 1 |
|
+3
It's so sad that I got everything in E right except the last part. I didn't compute i from 1 to M but only the factors of M (cuz of some wrong thoughts when I first read the problem I saw the sum must be M instead of sum not greater than M) and I got wrong answer on sample test 3. I thought the complexity is gonna be $$$O(nM^2)$$$ if I loop i from 1 to M and forgot that for high values of i the complexity of the dp will also decrease. I can't think of solution for D2 so I skipped D1 as well to do E since I have rough idea of E but in the end I failed to complete both D and E... |
|
+3
On line 55 of your program, your program will overflow the integer. change |
|
0
Your code might work in some ide because it is undefined behaviour. Anything (e.g. crash, output the thing you want, or in this case, output the wrong answer) can happen if undefined behaviour exists in your program. c99 Standard: 7.19.6.1: para 9: If a conversion specification is invalid, the behavior is undefined.225) If any argument is not the correct type for the corresponding coversion specification, the behavior is undefined. |
|
+6
This is not strange at all. Program returning 0 signals the program runs properly. Other return values signals the program not working properly due to incorrect input, memory issues, etc. |
|
+5
Score is decreased by (maxScoreOfProblem)/250 per minute. Wrong submission reduce score by 50 and the formula can be found in the rules when you enter a contest. |
|
0
You use %lld to output an integer. You should either store n as long long or output it using %d. Also, don't use cin mixed with printf. Use printf and scanf / cin and cout. |
|
0
It's true but it isn't really related to div.4 round. I can't see a relationship between div.4 round and rating inflation caused by new codeforces user as it is more related to quarantine. |
|
+3
As $$$10 + 66 = 21 + 55$$$, your solution is incorrect. |
|
+3
I think what you suggested is not valid as it doesn't supplied any pairwise sum. Both equal to 30 doesn't imply that the solution is wrong. |
|
0
I agree that it might be misleading but I didn't have any problem with understanding that word. I take it as the meaning of a simultaneous equation and didn't notice that word until I see this comment. |
|
+7
I just realized that I solve it for the negative too after seeing your comment. There is a negative number in the example of the question when it introduced the operations (not the test case). That was so misleading. |
|
0
I don't even understand what are you talking about. |
|
0
You should've at least posted your submission (78197703) here and not the link of the blog entry. |
|
+1
My bad. Your solution should output |
|
+1
Consider this test case Check whether your solution satisfy the requirement. |
|
0
MikeMirzayanov His two submission only differs by a new line at the end. I think this counts as repeated submission and maybe should be prevented? |
|
0
Basically, just practice. Your overall skill will improve. |
|
On
dreamoon_love_AA →
Codeforces Round #631 (Div. 1 and Div. 2) — Thanks, Denis aramis Shitov!, 6 years ago
0
I thought problem B was harder than problem C but in fact more people solved problem B. The fact that I know number of solutions of B must be of the count 0, 1 and 2 actually makes the problem harder. |
| Name |
|---|


