| # | User | Rating |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3603 |
| 4 | jiangly | 3583 |
| 5 | strapple | 3515 |
| 6 | tourist | 3470 |
| 7 | dXqwq | 3436 |
| 8 | Radewoosh | 3415 |
| 9 | Otomachi_Una | 3413 |
| 10 | Um_nik | 3376 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 157 |
| 2 | adamant | 152 |
| 3 | Proof_by_QED | 146 |
| 3 | Um_nik | 146 |
| 5 | Dominater069 | 144 |
| 6 | errorgorn | 141 |
| 7 | cry | 139 |
| 8 | YuukiS | 135 |
| 9 | TheScrasse | 134 |
| 10 | chromate00 | 133 |
|
0
|
|
0
My submission for E: http://mirror.codeforces.com/contest/1006/submission/40523424 Can someone help optimise this code? The logic seems simpler than the one in the editorial. |
|
0
My submission for D: http://mirror.codeforces.com/contest/1006/submission/40508497 Can someone give me a small test case where this fails? |
|
+5
Thanks! |
|
+5
Understood what you're saying. Thanks for being patient!!! |
|
0
Understood. Then shouldn't we multiply by -1? By adding mod we will get something else right? |
|
0
ai is always positive. Since diff[i] is sum of ai divided by positive numbers(2^n), it is also always positive. So I don't understand what could be negative and why we should add mod. Also where are taking mod for a negative integer, the minus sign is outside the multiplication? |
|
-8
My submission for E: http://mirror.codeforces.com/contest/1009/submission/40471843 Can someone tell me where the overflow is happenning and how to fix it? |
|
0
Can we say that the complexity is O(m) since it the loop runs atmost m number of times? |
|
0
Thanks! |
|
0
Can you help me figure out what's wrong with my solution for D? It's similar to yours http://mirror.codeforces.com/contest/1005/submission/40252820 |
|
+5
https://www.codechef.com/ide This is not a competitive coding platform: https://ide.geeksforgeeks.org/ |
|
0
Why are long and int of the same limits on the compiler used in Codeforces? In other websites long has wider range than int and equal range as that of long long. |
|
0
If the product of two ints are greater the max value that int can store, the product will overflow, despite the fact that the product variable has been defined as long long. Hence you need to typecast one of the ints to long long. You have to edit your code as (long long) i*cnt[i]. https://www.quora.com/Whats-the-use-of-1ll-in-statement-long-long-l-int-a-*-1ll-*-int-b-in-C-C++ |
|
0
You are given n line segments with their starting and ending points. Instead of storing all the points that these line segments, you only use the starting and ending points. So you store li and ri + 1 in a vector 'cval'. Then you sort and store only the unique elements in the vector. For each line segment in the input, you obtain the location of its starting and ending point in 'cval'. Now at the starting point you increase the count of line segments in the array 'cnt' and in the ending point you decrease. Now by obtaining the prefix sums of the values in 'cnt'. At 'cnt[i — 1]' you obtain the number of lines passing through the location i and i — 1 in 'cval'. The difference between cval[i] and cval[i — 1] gives you the number of points and cnt[i — 1] gives you the number of line segemnts passing through these points. By maintaining an array 'ans', we store the number of points with i line segments passing through them. |
|
0
Yeah that's exactly what I want. |
|
0
For problem A, why does this matter? "The solutions works because each number in the sequence 1, 5, 10, 20, 100 is a divisor of the number after it." |
|
0
Thanks! That was very informative! |
|
0
Can anyone explain what this loop does? for (int j = 0; j < k; j++) if (i & (1 << j)) c += n[j]; |
|
0
Can somebody share the implementation of the solution given for 873B and explain "That leads to a solution: for each value of balance maintain the minimum i where this balance is obtained (let it be called minIndex), and for each index i in the string update answer with i - minIndex(balance(i))"? |
| Name |
|---|


