My Rating Graph clearly depicts the guy who is the mayor of the friendzone.
I was about to break it through the friendzone and get laid today finally but long queues will most likely result in declaring the contest unrated.

Long queues... So most likely this contest is unrated.
Moment of silence for all our brothers/sisters who realized this news after 2+ hours on this contest, as they were only giving the contest to increase their rating.

In first operation, you xor every element with x.
In second operation, you xor every modified element with y.
This is same as, xoring original elements with (x^y).
In third operation, xor original elements with (x^y^z) instead of changing array after every operation.


For C, the basic observation is that the gcd value will either remain constant as we go down from the root, or it will atleast decrease by half. So there can be atmost 18 different points that we need to consider for removal.

You got to be kiddin me :|

1. No offence but either call me by my handle or I will change to purple.
2. 700 downvotes is way too much fucks to ask for.
3. Such complex analysis is not needed. You should keep that restricted to your graphs only.

My favourite line in this post.
On PetrAn unsportsmanlike week, 7 years ago

Man I seriously fucking wonder how you are a fucking +133.

Says the guy with +117 contribution :D


Okay, CF on a hat-trick.

On adedalicCodeforces Round #421, 7 years ago

My story since past few contests:
1. Eagerly wait for contest to begin.
2. Contest starts. Open problems.
3. All problems long af, difficult to understand.
4. Lose interest, order dinner, watch BBT, eat.
Is it only me or others too that have this feeling?

On djdollsCC June Long Challenge, 7 years ago

djdolls is back <3


You sure?
I gave Tinkoff round, and it was pretty challenging and I loved it.
I think you should not get frustrated so easily. Its not that easy to prepare a contest as you think.


The contest today wasn't that bad either.
It was his first time, so he tried to make problem A also non-trivial. Anyway, some people encourage stories in problems. I personally don't and have a feeling that majority doesn't like it. The statements could be made shorter and easy to read.
This is what CF rounds must check too. AtCoder also follows this.

On rng_58AtCoder Grand Contest 015, 7 years ago

Meanwhile rng_58 to Errichto ...

On gXaMinimum number of players, 7 years ago
  1. The algo will not be correct as I mentioned in my updated comment that it is similar to set-cover problem.
  2. In above case, the greedy sol selects column 4, column 2, and column 1. So it works in this case. In fact, the greedy soluton has approximation ratio  <  = ln(n) + 1
On gXaMinimum number of players, 7 years ago

What about using a greedy solution.
1. Pick the player with maximum number of fans.
2. Then remove all those fans.
Repeat this till each fan has been picked up.
UPD: Thinking more, isn't this the same as Set Cover Problem which is NP-Complete.

On vatsalHelp on a problem, 7 years ago

Start adding edges to DSU in order of their weight. Consider the current edge e = {u,v} with weight w.
1. If it is connecting the same component, then there would be a cycle forming. If that cycle has another edge of same weight, then this edge comes under "any". This also makes the edge that was added before with weight w to be labelled as "any". Otherwise, this edge will never come in MST, so it is labelled as "none".
2. Otherwise, if it is connecting different components, we label it currently as "at least one".
0 I hope this is correct, but will think and confirm soon.

Ultrafast speed of systest <3

[Problem D] I needed just 5 more minutes to solve D. Anyway I solved it as follows:
1. For each city, add itself to its adjacency list.
2. Using hashing, we will use DSU to make clusters of cities with exactly same adjacency.
3. Nodes in a cluster will have the same label value.
4. For each city, modify its adjacency list by replacing all cities in it by their representative i.e for (int v: g[u]) replace v by rep(v).
5. Now if there are more than 2 cities in any adjanceny list, its impossible.
6. Do a dfs, and carefully assign values :)

I hope this is a correct solution.
UPD: Here is the code that I missed by 5 mins.
UPD2: It got AC.


Let dp(i) denote the max beauty when you have to pick 2 fountains from first i fountains and you are selecting the ith fountain. When I am calculating dp(i) , I need to iterate over all j<i, and select the fountain that passes the budget and has the max beauty. This is O(n^2). BITs are used to speed this up.
I used BIT to compute prefix max. For fountain of price p and beauty b, I set bit[p] = b. To compute fountain with max beauty within price range <= K, we can take max from bit for prefix of length K.
Hope this helps. Have a good day!


I have done the same. Forgot to swap h, w and perform it again. I used set for those 34 elements. When for a particular mask, I select some of those 34 elements, I remove them from mask and give it to h, then to make w >= b, I greedily reverse iterate on the set till I make w>=b. code


WA on 27 in D. ARGHHHHH!


No there will be a different issue. 12*10^5 easily fits 256 MB.


We know he is a legend :) But he solved E after 41 minutes while you solved A after 22 minutes.


The contest is over but I am not able to see the submissions of other users. Why is it so?


C was easy to code using BIT. Not at all tedious. code


Hint: Note that bi >= 2. So you need at most 17 elements to make their product > 10^5.
Hint2: Suppose you are kinking K numbers. You will sort them in descending order and pick the first K numbers.


Very long queues.