### mohammedehab2002's blog

By mohammedehab2002, 8 months ago, ,

Hi!

I'm back with not one, not two, but three contests, although I have no promises about when to expect them....

The first of them, codeforces round #563, will take place on Jun/03/2019 17:05 (Moscow time). It's rated for the second division, but, as usual, first division participants can take part out of competition.

I'm the problemsetter of the round. I'd like to thank KAN for coordinating the round (and his patience .. try coordinating ~20 problems), arsijo for helping with the preparation, Um_nik, opukittpceno_hhr, Aleks5d, Rifai, pllk, ulna, Ivan19981305, and PrianishnikovaRina for testing the round, and MikeMirzayanov for the great codeforces and polygon platforms.

In this round, you'll be given 6 problems and 2 hours to solve them.

UPD: I decided to drop the 3 seconds rule. The scoring distribution is 500-1000-1500-1750-2500-2500. That means you should probably read both E and F :D

Good luck & Have fun!

UPD: here's the editorial.

UPD: congratulations to the winners!

Div.1+Div.2:-

Div.2:-

See you in the second round :D

• +466

 » 8 months ago, # | ← Rev. 2 →   +24 Trying to make enough money to afford MIT. I see you. Only a few ten thousand dollars left np
•  » » 8 months ago, # ^ |   +2 Dude, application fees :3 But first things first, how dare you say her name!
•  » » » 8 months ago, # ^ | ← Rev. 2 →   -40 I have stalked her long enough to at least be allowed to do so. Fight me.
•  » » » » 8 months ago, # ^ |   +6 I don't get it. Some internal joke?
•  » » » » » 8 months ago, # ^ |   +10 Alphatrance I think they're referring to this meme xD
•  » » » » » » 8 months ago, # ^ | ← Rev. 6 →   -19 deleted comment
•  » » » » » » 8 months ago, # ^ |   -16 lol
•  » » » 8 months ago, # ^ |   -32 chup mc
 » 8 months ago, # |   +90 By tradition, the scoring distribution will be announced 3 seconds before the contest.So accurate!
•  » » 8 months ago, # ^ |   +3 But now rules should get changed
 » 8 months ago, # |   -13 Imagine next rounds you would actually use high precision clocks to measure the interval of announcing score distributions... ;)
•  » » 8 months ago, # ^ |   -8 Maybe even high-precision randoms!
 » 8 months ago, # |   -7 The time is good for Chinese.
•  » » 8 months ago, # ^ |   +2 Oh,No.The best time is before 8 p.m, so that they can go to bed earlier.
•  » » 8 months ago, # ^ |   -26 code with girlfriend wonderfully
 » 8 months ago, # |   +2 i m very excited about the new contest
•  » » 8 months ago, # ^ |   -8 Yeah1.
 » 8 months ago, # | ← Rev. 2 →   -23 4 contests in the next 7 days, great.
•  » » 8 months ago, # ^ |   -25 4(2)
 » 8 months ago, # |   0 Looking forward to more fun XOR questions
 » 8 months ago, # |   -23 Upvoted for creating 3 contests simultaneously (Great job!).Downvoted for not capitalize "Codeforces" and "Polygon".
•  » » 8 months ago, # ^ |   +44 How did you vote twice??
 » 8 months ago, # |   +10 It seems that another competition season has comeSo many contests these days :)
 » 8 months ago, # |   +11 mohammedehab2002 previous rounds all problem names start with "Mahmoud"(round #396), "Ehab"(round #525) and "Mahmoud and Ehab"(round #473). Guess which start is next ??
•  » » 8 months ago, # ^ |   +13 To get all the combination, Ehab and Mahmoud is the last one to start with :)
•  » » 8 months ago, # ^ |   +21 the next start is an empty string
•  » » » 8 months ago, # ^ |   -8 HaHaHa
•  » » » 8 months ago, # ^ |   +16 John cena problems
•  » » 8 months ago, # ^ |   -14 or maybe concatenated version MahmoudEhab:)
 » 8 months ago, # |   -22 up to which rating second division?
•  » » 8 months ago, # ^ | ← Rev. 3 →   +8 Upto 2099, but if div1 and div2 rounds are held simultaneously people who are rated greater than equal to 1900 must participate in div1
 » 8 months ago, # |   -8 Wait, sorry guys I am new here. Do you have to start at that exact time? Or is there a contest window where we can choose to do it?
•  » » 8 months ago, # ^ |   +6 You need to register before the contest starts. Registration's usually open till 5 minutes prior to the start of a contest. Some contests support extra reg which opens 10 minutes after the contest start and continues for 20 minutes.
•  » » » 8 months ago, # ^ |   -8 I did register, but do you have to start at that exact time? Thanks,
•  » » » » 8 months ago, # ^ |   -20 You can start the contest any time, only registration's the key. Though the quicker you solve a problem the more points you receive for it.
•  » » 8 months ago, # ^ |   +41 There's no window, the contest starts at the same time for everyone.
 » 8 months ago, # |   -8 Let's get ready to rumblllllllleeeeeeeeeeeeeeeeeeee!!!!!!!!!!!!!!
•  » » 8 months ago, # ^ |   -8 cute !!
 » 8 months ago, # |   -8 Hope this round not unrated and no accident
 » 8 months ago, # |   -6 Do we have a hacking phase?
•  » » 8 months ago, # ^ |   0 No
•  » » » 8 months ago, # ^ |   +14 No u
 » 8 months ago, # |   +15 Scoring distribution shall be announced 3 seconds before contestI decided to drop the 3 seconds rule. The scoring distribution is 500-1000-1500-1750-2500-2500.Rules are made to be broken here. xD
 » 8 months ago, # |   +8 You really like GCD and prime numbers ! (WOW!)
•  » » 8 months ago, # ^ |   0 The description of the topic is short and concise。
 » 8 months ago, # | ← Rev. 2 →   -12 Apparently, it wasn't.
•  » » 8 months ago, # ^ |   +18 if only query d at beginning and query s on LCA then will get FST  /\ /\ \ /\ \ \ /\ \ \ \ but I have no idea to solve it correctly now : /
 » 8 months ago, # |   +1 How To solve problem D ?
•  » » 8 months ago, # ^ |   0 Think in terms of prefix xors.
•  » » 8 months ago, # ^ |   +4 Instead of directly construct the array, just construct the prefix xor version of the array S1, S2,..., Sn. So the condition that no subseg has the xor equals to 0 or x is the same as the array S is distinct and there is no pair in S that xor of them is x. So iterate from 1 -> 2^n-1, if x^i also belongs to the given range [1, 2^n) then just pick one, or else pick both.To construct the answer array A from S, use : Ai = Si^S(i-1).
•  » » » 8 months ago, # ^ |   0 What is prefix xor ? And why prefix xor array changes the condition?
•  » » 8 months ago, # ^ | ← Rev. 2 →   +16 First observation, if there is no number x restricted. You can simply construct something like 1 2 1 4 1 2 1 8 1 2 1 4 1 2 1... This pattern is optimal because at every i-th number where i is 2^x, you cannot add any new number using numbers in range [1..2^x), any new addition will cause XOR to be 0. Hence, you will need to add 2^x every time you are at the 2^x-th number (1, 2, 4, 8, 16, ...).Now, what about the restricted number? Well you can simply take the biggest 2^x that forms x. e.g. if x is 5, restricted number will be 4. Now, you can simply skip the restricted number when you want to form the sequence. (Why biggest? To minimize the largest number in the sequence) e.g. x = 5 1 2 1 8 1 2 1 16 1 2 1 8 1 2 1, if at any time the number has exceed 2^n, just stop adding new sequences.
•  » » » 8 months ago, # ^ |   +1 Nice approach. Here is my code implementing this: https://codeforces.com/contest/1174/submission/55059114 .
•  » » 8 months ago, # ^ |   0 What can be pretest 7?
•  » » » 8 months ago, # ^ | ← Rev. 2 →   0 I thought of something like 4 5. Answer should be longer than 1 2 1 8, ... But I initially only answered 1 2 1 which is a wrong answer
•  » » 8 months ago, # ^ | ← Rev. 3 →   +20 I will explain the complete solution of D. Hint 1Suppose you calculate accumulate xor sequence. If $a =${$1,3,1$}, accumulate xor is {$0, 0 \ xor \ 1, 0 \ xor \ 1 \ xor \ 3, 0 \ xor \ 1 \ xor \ 3 \ xor \ 1$} $=$ {$0,1,2,3$}.Suppose the problem is not "There is no subsegment which xor is $0$ or $x$", but "There is no subsegment which xor is $0$". In this problem, the only condition that the sequence should satisfy is that "All values of accumulate xor is different". For example, sequence {$1,3,1$} satisfy the condition because accumulate xor is {$0,1,2,3$} and it's all different, but sequence {$2,1,1$} does not satisfy the condition.So, it means if $x$ is greater than or equal to $2^{N}$, you should output the sequence which is length $N−1$: {$0 \ xor \ 1, 1 \ xor \ 2, 2 \ xor \ 3, ..., (N−2) \ xor \ (N−1)$}. Hint 2So what about the pattern of $x < 2^{N}$? Let's think about some cases. If $N=3$ and $x=4$, one of the optimal accumulate xor sequence is {$0,1,2,3$}. If $N=3$ and $x=2$, one of the optimal accumulate xor sequence is {$0,1,4,5$}. If $N=3$ and $x=1$, one of the optimal accumulate xor sequence is {$0,2,4,6$}. Seems like the maximal length of accumulate xor sequence seems to be $2^{N}−1$. That is true but why? In this case, two condition must be satisfy to not include a subsegment of $0$ and $x$: 1. All of the values in accumulate xor sequence is different. 2. Both $0$ and $0 \ xor x$ should not be in accumulate xor sequence. Same for $1$ and $1 \ xor x$, ... $2^{N}−1$ and $2^{N}−1 \ xor \ x$.So, you should choose the value $i$ which is $0 \leq i < 2^{N}$ and $i < (i \ xor \ x)$. For example, if $N=3$ and $x=7$, you should choose the value {$0,1,2,3$}.Finally, you should restore the sequence from accumulate xor sequence. In the example of $N=3, x=7$, one of the possible answer = {$0 \ xor \ 1, 1 \ xor \ 2, 2 \ xor \ 3$} = {$1,3,1$}. Source CodeMy Solution of problem D
 » 8 months ago, # |   0 I found B to be harder than C and D maybe because I was approaching it wrong way.
 » 8 months ago, # |   0 How to solve B? And why does it get TLE 55041556 ?
•  » » 8 months ago, # ^ |   +3 To be honest, B is so simple. If we have both odd and even numbers, then the sorted array is the answer, or else just print the original array. Correct me if I'm wrong
•  » » » 8 months ago, # ^ |   0 Maybe i dont understand you but what about this test: 3 2 3 2 1 (n = 5)
•  » » » » 8 months ago, # ^ |   0 Oh. Why 1 will be at the first place? We can swap only odd and even numbers, isnt?
•  » » » » 8 months ago, # ^ |   0 It is 1 2 2 3 3. Because both odd and even exist, we can easily prove that using the allowed operation could sort the array, and obviously the lexicographically smallest array.
•  » » » » 8 months ago, # ^ |   +11 "You can perform the following operation on it as many times as you want:". Of course i again solve another problem (( .
•  » » » » 8 months ago, # ^ | ← Rev. 2 →   0 You could swap the array as: 3 2 3 2 1 -> 2 3 3 2 1 -> 1 3 3 2 2 -> 1 2 3 3 2 -> 1 2 2 3 3 -> swap can be performed as many times needed
•  » » 8 months ago, # ^ |   0 if the input contains both odd and even numbers the result will always be a sorted array.
•  » » 8 months ago, # ^ |   0 You need to notice that, if there are only odd or only even numbers you can not make any swap. Otherwise you can sort the whole array.
•  » » 8 months ago, # ^ |   +3 If we have at least one odd and another even number, we will be able to reorder the whole array (swap two odd numbers or two even numbers). For example, if you wanna swap two odd numbers o1 and o2, with an even number e, you can do:swap o1 and e, swap e and o2, swap e and o1.And the position of o1 and o2 was swapped as a result.
 » 8 months ago, # |   +6 Hints for F please.
•  » » 8 months ago, # ^ |   +18 Firstly, ask the distance from 1. Now find the centroid of the current tree and check if it is an ancestor by checking if dist(root,centroid)+dist(x,centroid) == dist(root,x) , if that holds true, query the next node on the path and make it the root and now distance from root is dist(x,centroid)-1. otherwise, you can delete the subtree rooted at the centroid and everything else remains the same.
•  » » » 8 months ago, # ^ |   0 how to find centroid ?
•  » » » 8 months ago, # ^ |   0 But I got WA on test 12... have you got AC like that?
•  » » » » 8 months ago, # ^ |   0 Try to optimize queries if you don't have any bugs.
•  » » » » » 8 months ago, # ^ |   0 I don't even know.. WA because of Wrong Node or WA because of too many queries
•  » » » » » » 8 months ago, # ^ |   0 You can count queries, and exit with some code if limit exceeded. You will see this code.
•  » » » » » » » 8 months ago, # ^ |   0 Man, if I knew that, I would have solved it!Thank you for the tip XD
•  » » » » » » » 8 months ago, # ^ |   0 WOW,very clever
•  » » » » 8 months ago, # ^ |   0
 » 8 months ago, # |   +2 I've seen successful hacks made. Any hints what they were about?
•  » » 8 months ago, # ^ |   +3 In my room there were submissions that checked if there is any odd numbers and sorted based on that (I found one more submission like that after the end of contest :@ ) .
•  » » 8 months ago, # ^ | ← Rev. 2 →   +3 One of the mistakes on problem A was dividing sum of the numbers by 2 for checking the answer, while the sum is odd.Sorry for bad English. :)
•  » » » 8 months ago, # ^ |   0 Your English is fine :D I understood
•  » » » » 8 months ago, # ^ |   0 Thanks :) I tried too much to write understandable.
 » 8 months ago, # |   +5 How to solve F?
 » 8 months ago, # |   +5 god damn it when I started to feel I'm halavin I failed on the fourth hack
•  » » 8 months ago, # ^ |   0 wow 3 hacks, how did you get them? was there a corner test case or something?
•  » » » 8 months ago, # ^ |   0 Who did not solve A by sorting the array for some reason they were swapping the first different element from the first half with the other half and then print the array
•  » » » » 8 months ago, # ^ |   0 nice
•  » » » » 8 months ago, # ^ |   0 Isn't there an ambiguity in Problem A? In the end, it says "They must form a reordering of a. You are allowed to not change the order". What does that mean? As per my understanding, it meant that we're allowed rotate the array(so that ordering remains same) but, can't sort it completely.
•  » » » » » 8 months ago, # ^ |   0 you are allowed to not change the order means you can leave it as it is and they must form a reordering of a means you can swap any element as many times as you want
•  » » » » » » 8 months ago, # ^ |   0 Oops, that reordering thing got me. Thanks.
 » 8 months ago, # |   0 seem too difficult for me..... the code has some question...
 » 8 months ago, # |   -12 this is the worst!
 » 8 months ago, # |   0 Hints for F? Can it be solved using LCA?
•  » » 8 months ago, # ^ |   0 it can be solved using Centroid
•  » » » 8 months ago, # ^ |   0 what is centroid decomposition, any good blogs and tutorials on it, from where u learn.
•  » » » » 8 months ago, # ^ |   0
•  » » » » » 8 months ago, # ^ |   0 Thanks! codeforces really expose u to a lot of things u can learn through ur journey of competitive programming.
 » 8 months ago, # |   +30
•  » » 8 months ago, # ^ | ← Rev. 2 →   +14 After solving (A,B,C)^zzzzzzzzzzzz 01:59:29 Successful hacking attempt
 » 8 months ago, # |   0 How to think and approach problem D?
•  » » 8 months ago, # ^ |   0 Every number has only one number that makes (A^B == X) true. The problem asks for sub segment so it's another way to tell you to think of prefix xor. The answer should be clear after that.
 » 8 months ago, # |   0 fml, my bug on F was that I'm doing return the answer if there is only one edge from the current node, which should be the back edge to the parent, but I forgot the root! Nice round, I really liked it :D
 » 8 months ago, # |   0 Any ideas for E? i see most solution use dp. can anyone explain!
•  » » 8 months ago, # ^ |   -8 For E, $a_1=p_1^{e_1}p_2^{e_2}$. then max is $1+e_1+e_2$. that's exp step down. so $a_1$ must be $2^k$ or $2^{k-1}3$ (if $\leq n$). then remain is combination count. but no time to code.. the annoying $3$.Am I right? or is there a better solution? wait for tomorrow morning:) sleep now
•  » » » 8 months ago, # ^ |   0 editorial has come
•  » » 8 months ago, # ^ | ← Rev. 3 →   +64 Actually, I didn't use DP. I used only multiplying. Seriously, I didn't use DP. My solution of problem E is as follows: --- Step 1: What is the maximal possible value of $f(p)$? Actually, the maximal possible value of $f(p)$ is as follows: $1 \leq N \leq 1$ : $max=1$ $2 \leq N \leq 3$ : $max=2$ $4 \leq N \leq 7$ : $max=3$ $8 \leq N \leq 15$ : $max=4$ $16 \leq N \leq 31$ : $max=5$ But why? Think about the sequence of {$g_1,g_2,g_3,...,g_k$} if you assume $g_1>g_2>g_3>...>g_n$. For example, if $A=$ {$4,6,2,1,5,3$}, the prefix gcd will be {$4,2,2,1,1,1$}, so $g$ will be {$4,2,1$}. Because the optimal sequence of $g$ is {$2^{k−1},2^{k−2},2^{k−3},...,4,2,1$}. Suppose $N=11$. For the sequence {$8,4,2,1,11,10,9,7,6,5,3$}, it is easy to find that $g$ is {$8,4,2,1$}. --- Step 2: How many ways are the maximal answer? Let's think about writing the value of $a_i$ which changed the prefix gcd. For example, if $g$ is {$8,4,6,5,2,3,1,7$}, the values that you will write will be {$8, 4, 6, 5$}. So what is the possible sequence of values which you will write? Suppose $N=8$. 1st value: $8$. Only $1$ way. 2nd value: $4$. Only $1$ way. 3rd value: $2, 6$. $2$ ways are possible. 4th value: $1, 3, 5, 7$. $4$ ways are possible. So the number of possible sequence of values which you will write will be $1 \times 1 \times 2 \times 4 = 8$. But, how about the other values? If sequence is {$8,4,6,5$}, you should insert other values: {$1,3,7,2$}. You should think about inserting in order of $1, 3, 7, 2$. (Insert from values which is not divisible of $2$, next not divisible for $4$, next not divisible for $8, 16, ...$ There are $1$ ways to insert $1$: Just after $5$. There are $2$ ways to insert $3$: Just after $5$, or just after $1$. There are $3$ ways to insert $7$: Just after $5$, just after $1$, or just after $3$. There are $5$ ways to insert $2$: Just after $6, 5, 1, 3$, or $7$. So for each sequence you wrote, there are $1 \times 2 \times 3 \times 5 = 30$ ways of insertion. It means there are $8 \times 30 = 240$ permutations of $N=8$ which is maximal. So, let's move on another example. Suppose $N=11$: Ways to write: $1 \times 1 \times 3 \times 6 = 18$ ways Ways to insert the other values: $1 \times 2 \times 3 \times 4 \times 5 \times 7 \times 8 = 6720$ ways So, the answer will be $18 \times 6720 = 120960$. Did you get it? :) --- Step 3: Thinking about other cases, not only $g =$ {$2^{k−1},2^{k−2},...,4,2,1$} If $N=12$, not only {$8,4,2,1$} is maximal, but also {$12,4,2,1$}, {$12,6,2,1$}, {$12,6,3,1$} is maximal. So you should brute force sequence $g$ (There are up to $O(\log N)$ ways). If you determined the sequence $g$, you can do like step 2: first calculate the number of sequence that you will write, second calculate the number of ways of insertions and finally mutiplies. Since the complexity for each $g$ is $O(N)$, so the total complexity is $O(N \log N)$. If you precount factorial and inversions, you can also solve with $O(N+\log^2 N)$. Sorry for my poor English. Code (Uploaded at 2:01 JST, 56 minutes after the contest)
•  » » » 8 months ago, # ^ | ← Rev. 3 →   0 Thanks for your great explanation ! I just have a small question: In step 2, when you were inserting values 1,3 and 7, why isn't it possible for all of the values to be inserted before 5?
•  » » » » 8 months ago, # ^ | ← Rev. 2 →   0 No need for further explanation. I get it now by some other way (not sure if it is different from your explanation) 1st number has only 1 option, which is 8 2nd number has only 1 option, which is 4 3rd number has 2 options, 6 & 2 (suppose we take 6) 4th number has 5 options, 1,2,3,5 & 7 (suppose we take 7) 5th number has 4 options, 1,2,3 & 5 (suppose we take 5) ... we continue like this the result = 1 * 1 * 2 * 5! = 240
•  » » » 8 months ago, # ^ |   0 Thanks
 » 8 months ago, # |   0 seems that problem B shares the same trick with problem C in Global Round 3..
•  » » 8 months ago, # ^ |   +1 what i felt and is true for most cases : if u don't know proof just input garbage and get gold.
•  » » 8 months ago, # ^ |   0 Yeah exactly same over here too!
 » 8 months ago, # |   0 I like problem E.
•  » » 8 months ago, # ^ |   0 can u explain ur approach ?
 » 8 months ago, # |   -19 Thanks for mathforces (no)
 » 8 months ago, # |   0 Tears of unskilled.
 » 8 months ago, # | ← Rev. 4 →   +19 X is 29.Apparently this tc was not there in PreTest of F.Naive Solns asking only type 2 queries will take atleast 8 queries. Extending this tc — for $n*(n+1)/2$ vertices will take $n$ queries.
 » 8 months ago, # |   0 In the problem A, it was mentioned in the problem that order of the array should not be changed! What did that line mean and how do we reorder it without changing the order? Please Help!
•  » » 8 months ago, # ^ |   +3 "You are allowed to not change the order", not "You must to not change the order"
•  » » 8 months ago, # ^ |   +6 Please read it carefully : You are allowed to not change the order. I guess u miss read it as: You are not allowed to change the order. 
•  » » » 8 months ago, # ^ |   0 Oops! Thank you so much! Will surely take care from next time!
 » 8 months ago, # |   +1 $A, B$ and $C$ felt like typing test. The situation drastically changed afterward :(
 » 8 months ago, # |   -8 Very very nice contest, 10/10. Tl63 just because of using included sort. I hate this test -_-. But in general all it was good.
 » 8 months ago, # |   +3 Can someone explain how to solve this example in F?
•  » » 8 months ago, # ^ |   +3 You can use a method named "Heavy-Light Decomposition".
 » 8 months ago, # |   +11 wow I got TLE on test 63 and my rating is gone
•  » » 8 months ago, # ^ |   +15 The test 63 is the hack I used during the round, so I want to clarify a couple of points:First that seems the only test with anti Quick sort test, I can see that 150+ solutions failed this test and if it wasn't added all these solution may have been passed, I've also always see Quick sort solution pass sys test in previous rounds, so I think such test should be always added to any problem that require sorting.Also I'm not very proud with that kind of hack, because all I did is check if a java solution that uses sort for primitive array, so I want to raise attention against this.For those who still want to use primitives you can build your own sort function like the radixSort function that I use in my solutions, wich I copied from uwi code ( I hope he doesn't mind )
 » 8 months ago, # |   0 JAVA submissions have been judged on the C++ time limit for the B question. Getting a TLE for an O(nlogn) approach. However I didn't use a StringBuilder which is bad on my part but still a correct solution should pass.
•  » » 8 months ago, # ^ |   0 Yeah i notice that. Everyone using java got TLE. I did it using StringBuffer still got TLE.
•  » » 8 months ago, # ^ |   0 Problem is not time limit. Problem is the inbuilt sort in Java have worst case complexity of n^2. Hence the time limit. There is blog somewhere on the codeforces discussing this SORTING IN JAVA.
 » 8 months ago, # |   0 Hope that the rankings would be revised. Otherwise rating would take a great hit.
 » 8 months ago, # | ← Rev. 2 →   0 55036867 why using StringBuildfer was wrong and a get TLE? javaUPD: 55052153 problem was oin primitive types, only in that, i am so disappointed=(
•  » » 8 months ago, # ^ |   0 Everyone using java got TLE.
•  » » » 8 months ago, # ^ | ← Rev. 2 →   0 no i see guy who didnt use stringbuilder, just sout and hes solution was accepted
•  » » 8 months ago, # ^ |   +2 Arrays.sort() for primitive data types in java uses quick sort O(n^2) while Collections.sort() uses merge sort . Quick sort can have O(n^2) complexity in worst case
•  » » » 8 months ago, # ^ | ← Rev. 4 →   0 55023792 only cuz he used wrapper he passed? nice one
•  » » » » 8 months ago, # ^ |   0 So we were supposed to know that it was going to give a TLE?
•  » » » » » 8 months ago, # ^ | ← Rev. 2 →   0 now we know; somedyas it will helps, but not tooday; so shitty feeling
•  » » » » » » 8 months ago, # ^ |   0 63 was the last test case. Looks like some put it there intentionally knowing all java solutions would fail. lolxD
•  » » » » » » 8 months ago, # ^ |   0 The ratings have changed. its -8 for me,no a big fall so i have no issue.
•  » » » » » » » 8 months ago, # ^ |   0 its not about rating, its about solution, we did it right, but java fucked us
•  » » » » » » » » 8 months ago, # ^ |   0 yes that is correct. I could have saved some time and did problem 3 a lot sooner. But i decided to do B first which did take some time which is now all waste.
•  » » » 8 months ago, # ^ |   0 Java uses Mergesort for user defined objects and quicksort for the rest.Using List or Array won't make a difference i guess.
•  » » » 8 months ago, # ^ |   0 So what we are not supposed to use Arrays.sort() in future contests?
•  » » » » 8 months ago, # ^ |   +1 in this particular case, we can use Integer insted of int, looks like its using another, type of sort, need to check source of class Arrays
•  » » » » 8 months ago, # ^ | ← Rev. 2 →   0 what i found
•  » » » 8 months ago, # ^ |   0 Also judgement was based on 1s time limit. For java it should be 2s i guess.
•  » » » » 8 months ago, # ^ |   0 Does the TLE differ for different languages?
•  » » » » » 8 months ago, # ^ |   0 No I was mistaken. Checked previous contests and found that time limit is same for all languages. However many other platforms have extended limits for Java and Python.
•  » » 8 months ago, # ^ |   0 I also used BufferedReader, Arrays.sort(), and StringBuilder but still got a TLE :(
 » 8 months ago, # |   +3 Lmao, I was so pissed when my naive solution for F had bugs and didn't get accepted, while so many people solved it.Now I see anyway my naive solution would have got verdict Wrong answer on test 99xD.
•  » » 8 months ago, # ^ |   0
•  » » » 8 months ago, # ^ |   +10 Wow, such a great hack. Congrats!
 » 8 months ago, # |   +6 Wrong answer on test 99. Such pain in F
 » 8 months ago, # | ← Rev. 2 →   +50 Problem F
•  » » 8 months ago, # ^ |   0 But I still don't get why?
•  » » » 8 months ago, # ^ | ← Rev. 3 →   0 Clever naive soln take $O(\sqrt N)$ queries in worst test case.Worst Test Case
•  » » 8 months ago, # ^ | ← Rev. 2 →   +12
 » 8 months ago, # |   +3 I passed F in last 5 minutes. Exciting!Thanks for the round very much!
 » 8 months ago, # |   0 Sorry, does the #23 testcase from F shows "wrong answer query limit exceeded"? I made a submission with assertion but couldn't see that I was exceeding the limit. 55048680
•  » » 8 months ago, # ^ |   0 May be it's because you have a query in your main but you didn't count that ?
 » 8 months ago, # |   +3 https://codeforces.com/problemset/problem/1054/D a question similar to today's D
 » 8 months ago, # |   +4 Nice Contest.Btw a simiar (a̶n̶d̶ ̶a̶n̶ ̶e̶a̶s̶y̶ ̶v̶e̶r̶s̶i̶o̶n̶?̶) of F recently appeared in Codechef Cook Off MYS00T
 » 8 months ago, # |   +8 Problem F, a very nice tree and interactive problem! Thanks for writers.
 » 8 months ago, # |   0 Well I'm stupid and haven't debugged my F during contest, but here is my solution that should works but it got AC:First of all let's know a height of x by first type of query with vertex 1, let it be H.Let root be the lowest vertex that we know that has X in it's subtree. So let choose a type of query randomly!If we chose first type then just choose some vertex with height H in root subtree randomly and then change root!If we chose second type then just change a root!
 » 8 months ago, # |   +15 Was a randomized solution intended to pass for F?Instead of using any heavy-light/centroid decomposition, I just picked a leaf at random for the current subtree, and then asked similar queries as given in the editorial.https://codeforces.com/contest/1174/submission/55047296
•  » » 8 months ago, # ^ | ← Rev. 3 →   0 I dont think randomized was intended. But sometimes its difficult to break randomised. Until and unless probability of failing it is high.I did saw some randomised solns and one of my friend also used randomised in F.
 » 8 months ago, # |   +9 Since editorial is not linked — EDITORIAL
 » 8 months ago, # |   -16 ^ Click here to go up! ^
•  » » 8 months ago, # ^ |   +9 what about the left of your monitor xD
•  » » » 8 months ago, # ^ |   0 The button is not there always! -_-
 » 8 months ago, # |   -15 how. to. calculate. the. contribution. ?why. the. contribution. for. me. is. negative. ? i. do. nothing. God
•  » » 8 months ago, # ^ |   0 Simply, as far as I know, the contribution points are the sum of the total votes you get in your blog posts and comments/replies divided by 5. Or maybe, it uses some logarithmic calculations.If your total votes are 100, your contribution will be (100/5) = 20. And if it's -100, your contribution will be (-100/5) = -20.Check those out:
•  » » » 8 months ago, # ^ |   0 ok. thanks.
 » 8 months ago, # |   +5 Very neat and clear problem descriptions. Thanks to the writer.
 » 8 months ago, # |   0 Isn't there an ambiguity in Problem A? In the end, it says "They must form a reordering of a. You are allowed to not change the order". As per my understanding, it meant that we're allowed rotate the array(so that ordering remains same) but, can't sort it completely.
 » 8 months ago, # | ← Rev. 2 →   +4 I think there is a time limit problem in problem 2 for java. Same logic gets accepted for C++ but TLE for java..
 » 8 months ago, # |   -8 How to solve the problem D ??
 » 8 months ago, # |   0 hello .. can any one fix this issue with the problem A in round 563 div 2 i had a working code which not getting passed the test #9 here is my code http://codeforces.com/contest/1174/submission/55111106 could any one help me with this...
 » 8 months ago, # |   0 You can change the tags of new problemsYou can put the segment tree or... next to the data structure tag