| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | Kevin114514 | 3659 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3382 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3312 |
| 10 | idontwannadothis…e | 3191 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 155 |
| 2 | nik_exists | 151 |
| 3 | maspy | 149 |
| 4 | AmShZ | 145 |
| 5 | Um_nik | 143 |
| 6 | Errichto | 139 |
| 7 | BledDest | 136 |
| 8 | adamant | 134 |
| 9 | maroonrk | 132 |
| 10 | cry | 130 |
|
0
As one of the comments already mentions, using the inverse modulo of the factorial in the denominator would work. I wrote code for this problem in which I had to find the sum of combinations, although not the same ones. Code for calculating nCr in O(1) with O(n) precomputations |
|
0
This is the accepted code, for your reference :) |
|
0
$$$a_i \gt 0$$$, so every number has at least 1 bit set. So over a segment of length 61 or more, we are guaranteed to have a sum $$$S \geq 61$$$. Since the maximum value for $$$b_i$$$ is 61, we can be sure that this segment has $$$S \geq b_i$$$. Do comment back if you didn't understand something :) |
|
0
Can you post the code in a spoiler? |
|
0
If k <= 50, it is $$$5k^2/3$$$ In each case just calculate the numerator and see if it is divisible by the denominator.
|
|
+1
For those who didn't understand why removing one of the ends gives the optimum length
|
|
+18
I love how you separated the editorial into key idea and solution so people have a second shot at upsolving without looking at the solution |
|
+1
Maybe we can write an NN to find out whether an image is from an anime or not and crawl through every user's page on codeforces and find out the percentage? |
|
+65
I love how this has bitset as one of the tags. |
|
On
ABhinav2003 →
Problem 702A — Maximum Increase| What is wrong in this Plz HELP I SPENT 2 Days finding bug PLZZZZ HELP., 6 years ago
+3
It's the famous increasing subarray problem which can be solved by dp. I tried to understand what you coded and I think there are fundamental mistakes with logic looking at it.
Note : you can solve it using dp to maintain the length of the longest increasing subarray ending at index i or just maintain the maximum value saving memory. My submission uses the second approach. |
|
+4
Read the comments and the corresponding changes I made to your code. Do reply back if you don't understand the reasoning behind the changes, although I suggest you work them out yourself to understand where you went wrong :) I submitted the commented code and it got accepted. Also, you can look at my code for reference. Your code modified My code |
|
0
Can you update your discord link fam? I think the link expired and I couldn't join today :/ |
If you understand how MEX works, the problem is simple. The MEX of any path that doesn't contain the edge labeled 0 is 0. Find a vertex which has more than 3 edges, and mark them 0, 1, 2. Mark the remaining edges randomly. This ensures that the maximum MEX is 2. |
|
+11
Main code Take a cube and label it as follows. Now, we have 3 different kinds of rotations, each rotation has one of the above pairs fixed and the remaining ones complete some circles. Say we have {1, 2, 3, 4} as an array. Then one rotation gives {2, 3, 4, 1}. Similarly, the positions for rotation as per the above notation are {0, 2, 1, 3}, {0, 4, 1, 5}, {2, 4, 3, 5}. It is obvious that only 3 rotations are possible and 4th rotation gives us the original array. So here's what I did :
|
|
0
First of all, the answer is not $$$^{N}C_M$$$ as you think. You might want to think again or check the editorial. |
|
0
I have to appreciate your effort man. You did a great job. Some people are pissed because the Corona issue is something they take very seriously. Writing a statement about taking a vacation(problem D) is fine, according to me at least. But some may feel like you're encouraging or even subtly suggesting that it's okay to go outside, which we all know is not desirable during the current times because of this virus. Or let's take problem E, someone who's lost their job because of Corona may feel bad. The point of a problem is to solve it, not to nitpick on the statement. If a problem statement says you're superman, it doesn't mean you jump from a building because the statement said you could fly. So I think people should just chill out and enjoy the problems and not make a big deal out of it. |
|
0
The test case says access denied. So can you please post the test case instead of the link. code |
|
+3
Here's an explanation for D, if you haven't understood it from the editorial. Let $$$M' = (M_1+k)\%S, (M_2+k)\%S, .., (M_n+k)\%S$$$. If k=0, it is trivial. Suppose k>0. So there is no solution if $$$S \lt 2n$$$ as there should $$$2n$$$ unique elements($$$\neq k$$$ and $$$\neq S-k$$$) $$$\leq$$$ S and this is not possible. We don't know whether $$$S \geq 2n$$$ has a solution or not, but the construction in the editorial shows that it is always possible. |
|
0
Imagine the numbers 0 to n as the leaves of a binary tree of height ceil(log(n)). Suppose leaves are the level 0. After every match, a player moves up a level. So I think the level of LCA(as defined here) is the answer. Could be wrong, I would solve it like this. |
|
0
This is the one I can think of. Solve $$$i^{2}+i-n=0$$$ |
|
Segtree + lazy works
Sorry I don't know how to link SPOJ codes so I posted the code here Code |
|
+1
Only the number which you put first is taken as it is and the others have ~ added to them. So maintain prefix and suffix of ~ &. Answer would be maximum of pref[i] & $$$a_i$$$ & suff[i] for all i. pref[i] is the value of all the elements from 1 to i-1(using the ~ & operation) and suff[i] is the value of all the elements from i+1 to n(using the same operation). The editorial explains it better so you might wanna read that :) Check this submission for reference. |
|
+10
A | B has all the bits where A or B have 1, set to 1. A | B — B has only those bits set to 1 where A has a 1 but B doesn't have a 1. If B had a 1, then A | B would have a 1 in that position and — B would set that bit to 0. So it is equivalent to A & ~ B |
|
+3
The key idea is that if the adjacent characters are equal, then we can untangle them. So if a sequence of length n exists, we can change it to a sequence of length n-2 by deleting the adjacent ones. For example, (-++-) -> (--) -> () I used a stack to do this.
|
|
0
You're merging two sets even when they represent the same set. I added two lines to your code and it gets accepted. |
|
0
Binary search succeeds for day = 10, so we search over the range 1 to 9 and finally arrive at 9 to be the minimum day I think. |
|
+57
I'm not here to say "It's all going to be alright" or "Take some time off and do something you like" or generic things like that because I know they don't do any good to you in your current state. I've been diagnosed with clinical depression and was suicidal at some point. It took me 2 or 3 years to recover and even now I have occasional episodes of depression in my life. So when I say I understand how you feel, you know I do. Hell, I even tried to die, twice, and failed at it. So in a way, I was a failure at living as well as dying. The state of not caring that you mentioned about, I've been there too. I've hit rock bottom multiple times and all I did was to cry while the anti depressants were numbing my pain. Here's the thing. We are humans. Most of us care about too many things like our social status, grades, what people think about us,our ratings etc. And then there's people at the other end of the spectrum who realized that these are meaningless and don't matter. So they stop caring about these things. The important thing here is the "these things" mentioned in the previous line. We have to care about something. Without a something to care about, we get engulfed by emptiness. Usually, depression has a social stigma attached to it. It might be hard to ask someone for help. There might be feelings of paranoia which prevent you from opening up. So be it. At least, go visit a therapist. That will help you. Depression is a very common illness. It is termed as the common cold of mental illnesses. The only difference is that common cold doesn't kill while depression does. There is nothing to be ashamed of and every person experiences some form of depression, mild or extreme, at some point in their lives. Don't give up hope. It may or may not get better. But I know for a fact that you will become stronger. Your problems may become even worse and make you feel like giving up. But you will look them in the eye, say not today and solve them. So, stay strong. While I was struggling with depression, I read a lot of books to understand why I felt the way I felt and what to do to get out of it. And it was very very helpful. I'll dm the list to you if you want to give it a shot. And the books are not about rainbows and unicorns. They are about how sometimes life sucks and the healthiest thing we can do is to accept that sometimes life does suck and learning from our experiences. So, stay strong!! |
|
0
You have two types of diagonals, ones with i+j constant(top right to bottom left) and ones with i-j constant(top left to bottom right). When you take any square sub matrix and apply transpose, you find that elements on the 2nd type of diagonal change positions. But they remain on the same diagonal. In other words, [0][0] can't change it's place. [1][0] and [0][1] can swap places among themselves but not with any other element. We can also obtain any permutation of an (i+j) diagonal by starting with the top left corner and progressively fixing elements in the next diagonal by picking matrix of size 2x2 and swapping elements which aren't on the main diagonal of it. So we only need to check if the corresponding multisets of diagonal (i+j) are same. |
|
+1
There are only 1061 4-digit primes. Generate a graph with each vertex representing one of these primes. Add edges between two vertices if we can move from one vertex(prime) to another with a cost of 1. Notice that there can be atmost 39 edges per vertex so the number edges is O(n). Then, since the number of test cases are small and the cost for each edge is same, a simple bfs from the initial prime as the root should do the trick for each test case. |
|
0
Why is a random_shuffle performed at the end of the code for problem E? |
|
0
Thank you very much. I will declare variables common to function calls globally from the next time onwards. Once again, thank you for your time :) |
|
+1
His previous contests where he had a spike in ratings seem legit. Atleast he didn't get the increase by hacks. But the question is if he made submissions from his alt to confirm whether his solutions were correct or not, and then submitted them |
|
0
It won't happen every time I guess.... Next time he does a contest, if he doesn't get one of his alts in the same room, he'll surely fall down. |
|
0
We iterate a variable called mask from 0 to (1 << n)-1 Suppose our current mask is i. Suppose it has x bits set.This means that those fishes with the corresponding bit set are already dead. The number of fish left alive would be n-x. Now, we iterate through the bits in the mask and check which bits are not set(which fish are still alive). Now we simulate a fight between two fishes alive,that is,we select two fishes randomly with equal probability. That probability(p) would be 1/(# of ways to select two fishes from n-x fishes). Let those selected fishes be x and y. If x wins, we update dp[mask|(1 << y)]+=dp[mask]*p*a[x][y]. Similarly we update dp[mask|(1 << x)]+=dp[mask]*p*a[y][x]. The required answer would be dp[~(1 << i)] for the ith fish. This solution takes O(n^2*2^n) time and I think it might pass under the given constraints. |
|
0
It can be solved with dp + bitmasks I think... This might help you :) |
|
0
Than you very much. I was hoping for a response like this. Your points were very valuable and I will try my best to learn a new topic everyday(or week at least) and solve problems based on it. Also, thank you for suggesting the book CP3 book and I will surely start reading it asap. Good luck on your way to becoming an LGM :) |
|
+1
We are not supposed to round off the fraction mate :) |
|
0
That looks good, thanks mate! |
|
0
Can you post a link to your submissions please? Also, which question are you solving? |
|
0
The grid has n rows and m columns. We first calculate what is the cost for each column to turn it into black and white as well. Suppose we store the number of white cells in columns in an array whiteCount[n]. consider a 2-d array dp[n][2]; dp[i][0]=minimum cost to convert the current column completely into black and have the barcode valid. dp[i][1]=minimum cost to convert the current column completely into white and have the barcode valid. Now, Let's iterate through 1 to m columns. At every column, we have two choices.We paint it completely black or completely white. But, we also have to make sure that we have atleast x-1 and atmost y-1 columns behind the current column which have the same color. Suppose we are at column i. We now iterate j through columns i-y+1 to i-x+1 and find the cost to convert those columns to black.And the j-1 column should certainly have white. So, the dp relation would be, dp[i][0] would be minimum of (sum of whiteCounts from j to i + dp[j-1][1]) dp[i][1] would be minimum of (sum of blackCounts(can be obtained easily if you know whiteCounts) from j to i + dp[j-1][0]) Also, you can save time by checking out this blog entry and reading partial sum :) |
|
0
Hi, I think there is some problem with erasing the iterator while iterating through the map.. The output of this code shows that the value of m.end() is not updated in the first for loop. for(int i=0;i<n;i++)
{ int s,b;
cin>>s>>b;
m[s]=b;
}
int cnt=0;
map<int,int>::iterator it,it2;
for(it=m.begin();it!=m.end();it++)
{
cout<<"it 1 "<<it->first<<" "<<it->second<<endl;
for(it2=m.begin();it2!=m.end();it2++)
{
cout<<"it 2 "<<it2->first<<" "<<it2->second<<endl;
if(it2->first<s)
{ cnt++;
s+=it2->second;
m.erase(it2);
break;
}
}
}Input : 999 2 1010 10 67 89 Output: it 1 67 89 it 2 67 89 it 1 1330860869 1162633042 it 2 1010 10 also, I think m[s]+=b was what you were looking for :) |
|
+2
That meme never gets old This is exactly what I think when I solve a problem
|
|
0
Thank you. I definitely think those points you made will help me :) |
|
0
Thanks for your response mate. I'll try to solve more and more questions to get more experience :) |
|
+10
Thank you very much for your response. Also, do you solve questions from a2oj ladders or based on a particular topic(from a2oj)? (Also thanks for not going into energy saving mode Houtarou senpai :P) |
|
0
Thanks a lot!! "Tourist is no genius but he is simply good at it" I really love tourist lol |
|
0
Can you attach a link to the interview? It is always not a bad idea to read an interview of any LGM :) |
|
0
Isn't that a bit unfair? I mean the execution time was almost doubled due to sharing and if this happens during contests isn't there a possibility that someone gets a TLE and someone else with a similar code gets AC? What if a code doesn't even pass the pretests and some other similar code passes the pretests and gets accepted? |
|
+1
Thanks fam! Lol I misunderstood the question and I thought consecutive dances should not have more than one dancer in common. I should really stop thinking about sequences :) |
|
-16
Well... What if there is not gonna be a contest because April fools :P |
|
0
Thank you very much fam :) |
|
0
It doesn't take L to figure out that he is indeed retarded lol. |
|
+3
DEBUGGING: I don't know where you are, but I will find you.. and I'll fix you |
|
+30
Your pun is soo POLARizing It is borderline un BEARable :P |
|
-23
Lol that's because you don't watch stranger things |
|
-33
Fun Fact: Mille Bobby Brown is dating the biggest douche on earth(Jacob Sartorius)... If you don't know who that guy is, just don't watch a song called "sweatshirt" by him. I REPEAT DO NOT LISTEN OR WATCH THE SONG SWEATSHIRT BY JACOB SARTORIUS. |
|
+37
Come on guys, no need to be so harsh. Everyone makes mistakes. Maybe they had a rough day and didn't properly check their solutions. Look at the number of up votes for this announcement before and after the UPD. It is tougher to come up with a quality question than to solve it so we have to appreciate them. Good job guys!! Make sure you double check your solutions next time ;) |
|
+141
And porn |
|
0
Did anyone else get 0:00 on timer and contest not yet started message?? |
|
+3
But... it's not even december 31st.. |
| Name |
|---|


