### vovuh's blog

By vovuh, history, 21 month(s) ago, translation,

<almost-copy-pasted-part>

Hello! Codeforces Round #615 (Div. 3) will start at Jan/22/2020 17:35 (Moscow time). You will be offered 6 or 7 problems (or 8) with expected difficulties to compose an interesting competition for participants with ratings up to 1600. However, all of you who wish to take part and have rating 1600 or higher, can register for the round unofficially.

The round will be hosted by rules of educational rounds (extended ACM-ICPC). Thus, during the round, solutions will be judged on preliminary tests, and after the round it will be a 12-hour phase of open hacks. I tried to make strong tests — just like you will be upset if many solutions fail after the contest is over.

You will be given 6 or 7 (or 8) problems and 2 hours to solve them.

Note that the penalty for the wrong submission in this round (and the following Div. 3 rounds) is 10 minutes.

Remember that only the trusted participants of the third division will be included in the official standings table. As it is written by link, this is a compulsory measure for combating unsporting behavior. To qualify as a trusted participants of the third division, you must:

• take part in at least two rated rounds (and solve at least one problem in each of them),
• do not have a point of 1900 or higher in the rating.

Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you.

Thanks to MikeMirzayanov for the platform, help with ideas for problems and for coordination of my work. Thanks to my good friends Daria nooinenoojno Stepanova, Mikhail awoo Piklyaev, Maksim Neon Mescheryakov and Ivan BledDest Androsov for help in round preparation and testing the round.

Good luck!

I also would like to say that participants who will submit wrong solutions on purpose and hack them afterwards (example) will not be shown in the hacking leaders table.

</almost-copy-pasted-part>

This is unusual, but good news! Our friends at Harbour.Space have a message for you:

Hi Codeforces!

As a special prize for the Codeforces Round #615, we would like to invite the top 3 participants to take part in our Hello Muscat ICPC Programming Bootcamp, which will take place in Oman, from March 19 to March 25, 2020. The prize will cover the participation fee, accommodation, and half-board meals for the entire duration of the bootcamp (except flights)!

There are three requirements to satisfy:

• You took part in at least 10 rated contests on Codeforces
• Your max rating should be less than 1900
• You should be eligible for ICPC and/or IOI 2020+
Fill out the form→

So unofficial participants are also in a game (if meet the requirements).

Good luck to everyone!

UPD: I want to thank Artem Rox Plotkin and Dmitrii _overrated_ Umnov for invaluable help with the round preparation!

UPD2: Editorial is published!

• +220

 » 21 month(s) ago, # |   -33 First comment!!
•  » » 21 month(s) ago, # ^ |   -48 First dislike!
•  » » » 21 month(s) ago, # ^ |   +68
•  » » 21 month(s) ago, # ^ |   +82 Actually, you are not right. The first comment was 10 years ago when codeforces was just opened. The comment was created by VitalyPavlenko
•  » » » 21 month(s) ago, # ^ |   +20 who got First WA on test Case 5?
•  » » » » 21 month(s) ago, # ^ |   +25 As far as I can tell, it was user Haleh with this submission 213
•  » » » » » 21 month(s) ago, # ^ |   +3 Could you also find out who got first WA on test case 100?
 » 21 month(s) ago, # |   0 **hope i will be cyan after contest **
•  » » 21 month(s) ago, # ^ |   +1 Not bad!!
•  » » » 21 month(s) ago, # ^ |   +1 thanks bro --oldaccount--
•  » » 21 month(s) ago, # ^ | ← Rev. 2 →   0 thanks vovuh for make me happy today
 » 21 month(s) ago, # | ← Rev. 3 →   -13 Queueeeeeeeeeeeee.
 » 21 month(s) ago, # |   -12
•  » » 21 month(s) ago, # ^ |   -20 I can relate.
•  » » 21 month(s) ago, # ^ |   -7 indeed
 » 21 month(s) ago, # |   +51 codeforces: Div.3 contestme: Let's get a speed performance check.
 » 21 month(s) ago, # |   +24 Why is vovuh always in the makers of div3 rounds(This does not happen in div 2 rounds).No complains, just curiosity.
•  » » 21 month(s) ago, # ^ |   +17 I think that is so because vovuh started Div. 3 competitions. Not sure though....
 » 21 month(s) ago, # |   -7 Why someone sumbit a wrong solution on purpose then hack his solution ?
•  » » 21 month(s) ago, # ^ |   0 Maybe they wanted to be at the top of the hackers during the hacking phase.
•  » » » 21 month(s) ago, # ^ |   0 if so, what they will gain ?
•  » » » » 21 month(s) ago, # ^ |   0 What will they lose either? (Don't say rating as its probably their fake ID)
 » 21 month(s) ago, # |   +8 Again into the ashes
 » 21 month(s) ago, # |   0 I think smarter requirements are needed for prizes in order to get rid of smurfing.
 » 21 month(s) ago, # |   +7 15000 participants but 100 upvotes?
 » 21 month(s) ago, # | ← Rev. 2 →   +5 Hope to become cyan. Hey rising_from_the_ashes! I felt in love with your handle!
•  » » 21 month(s) ago, # ^ |   0 Thank you
•  » » 21 month(s) ago, # ^ |   0 I hope to become blue idk how the scoring works
•  » » » 21 month(s) ago, # ^ |   0 I think you are unrated for this contest as you are not trusted participant. Read this.
•  » » » » 21 month(s) ago, # ^ |   0 my rating is <1600
•  » » » » » 21 month(s) ago, # ^ |   0 but you haven't participated in more than 2 rated contest.
•  » » » » » » 21 month(s) ago, # ^ |   0 am I reading it wrong? if you are <1600 the contest is rated.
•  » » » » 21 month(s) ago, # ^ |   0 I'm still cyan but I made good progress
•  » » » 21 month(s) ago, # ^ |   0 hey, you can install its browser extension so that u will get an estimate that ur rating is going to change by how much
•  » » » » 21 month(s) ago, # ^ |   0 I think I will just wait to see what happens. Though the site is very unstable currently (last round only took 2 hours for ratings to change)
•  » » » » » 21 month(s) ago, # ^ |   +12 The site's not unstable, this round has a hacking phase that goes on for 12 hours after the contest. As successful hacks can change the results, standings are subject to change during the phase, and thus rating is not updated because rankings can change. Rating will update (relatively) shortly after the phase ends.
•  » » » » » » 21 month(s) ago, # ^ |   0 the site is unstable for me as I tried to submit stuff 2 hrs ago and I was getting 502 error pages didn't last round have hacking phase too?
 » 21 month(s) ago, # |   +3 Want to become cyan after this round.
•  » » 21 month(s) ago, # ^ |   0 Just like me!
 » 21 month(s) ago, # |   0 Guys! please answer me. How to tag someone by its handle in codeforces?
•  » » 21 month(s) ago, # ^ |   +37
•  » » » 21 month(s) ago, # ^ |   +8 Thanks! But I'm not a noob, I swear!
 » 21 month(s) ago, # |   -26 I hope to successfully give contest in guu health and vitaliti. And hopefully get me some bobs and vagene.
 » 21 month(s) ago, # |   +36 .
 » 21 month(s) ago, # |   0 Why i can't register now?
•  » » 21 month(s) ago, # ^ |   +2 there is many a times constraint in CF contest that you have to register atleast 5 min before the contest start
 » 21 month(s) ago, # | ← Rev. 2 →   -16 Hey, in my test 1 in problem C, i have a correct answer, but it's WA because my a[1] and n are dupcilate. Is it a bug in my test?
 » 21 month(s) ago, # |   +8 Long Queue!
•  » » 21 month(s) ago, # ^ |   0 gg
•  » » 21 month(s) ago, # ^ |   0 3 minute of queueueueue
•  » » » 21 month(s) ago, # ^ |   0 I was stuck for around 12-15 minutes.
 » 21 month(s) ago, # |   -9 Please do something about the long queue time. Thank you!
 » 21 month(s) ago, # |   -6 Queueforces!!!
 » 21 month(s) ago, # |   +63
•  » » 21 month(s) ago, # ^ |   +5 I got 9 penalty.
 » 21 month(s) ago, # | ← Rev. 5 →   -28 {Deleted}
•  » » 21 month(s) ago, # ^ | ← Rev. 3 →   +4 There is no reason to kill yourself right now because of some computer not working properly, you will die somewhen anyway
•  » » 21 month(s) ago, # ^ |   0 but the contest was extended 10 minutes
 » 21 month(s) ago, # |   0 anybody know how to solve E ?
•  » » 21 month(s) ago, # ^ |   -8 solve each column seperately. calculate how many steps of move 1 if you do k steps of move 2
•  » » » 21 month(s) ago, # ^ |   0 But is That solution O(N^2*M) ?
•  » » 21 month(s) ago, # ^ |   +5 Solve for each column independently. For each shift $0 \le s \lt n$, count how many numbers will match their intended positions after shifting (let it be $f_i$ for a shift by $i$). HintYou can efficiently count that by iterating over every number in the column and determining, which shift will put it in the intended position, if it exists at all (some easy math here).Then, for a fixed column, the answer is the minimum over all $n - f_i + i$, and the total answer is the sum of those.
 » 21 month(s) ago, # |   0 How to solve C ?
•  » » 21 month(s) ago, # ^ |   +1 Get all prime divisors of the given number. To calculate first number Fix the first number as the very first prime number.To calculate second number: Start multiplying from next prime number onwards until the product becomes greater than first number.To calculate third number: Product of all the remaining prime numbers.
•  » » 21 month(s) ago, # ^ | ← Rev. 3 →   +6 Find all divisors of n.Than brute over all pairs of divisors and let that number be a, b.Than c = n/(a*b); if c is not divisible by that multiplication than don't select this pair. else you have found your answer.My Submission
•  » » » 21 month(s) ago, # ^ |   0 https://codeforces.com/contest/1294/submission/69364122what is wrong in this?
•  » » » 21 month(s) ago, # ^ |   0 How your brute force pass?what is the maximum number of divisors a number has?I think it will be sqrt(n). Then how your solution pass.?
•  » » » » 21 month(s) ago, # ^ |   0 To find a divisor of a number you only need to check up to sqrt n. The number of divisors does not matter since we only need 3.
•  » » » » 21 month(s) ago, # ^ |   0 no, it is cube_sqrt(n)
•  » » » » 21 month(s) ago, # ^ |   +4 Any number less than $10^9$ has not more than $1344$ divisors, with $735134400$ having exactly that many. Actually, it is reasonable to estimate the number of divisors as $\sqrt[3]n$ for small numbers (even though it asymptotically grows slower than any polynomial).
•  » » » » » 21 month(s) ago, # ^ |   0 The growth of highly composite numbers is interesting since it balances having many small prime factors but not too many the same https://en.wikipedia.org/wiki/Highly_composite_number
•  » » 21 month(s) ago, # ^ |   0 Sqrt(n) * sqrt(n) brute force My submission . Recall that you can always find pairs of factors of a composite number by iterating to sqrt(n).
•  » » 21 month(s) ago, # ^ | ← Rev. 2 →   0 Project Euler style problem! Can be done without prime divisors list. Iterate over all c for c*c <= n. If c divides n, let ab = n / c. Iterate over all b for b*b <= ab. If b divides ab, let a = ab / b. Ensure a, b, c distinct.c is at most sqrt(n), b is at most sqrt(c), so algorithm is O(n^3/4) time
•  » » » 21 month(s) ago, # ^ |   0 don't you think 100(no of test cases)*10^(6.5)(if every number is 1 billion) would not pass in the given time limit at it is approx. 10^8.5.
•  » » » » 21 month(s) ago, # ^ |   0 I think the estimate is conservative as most numbers will terminate much quicker (it is still good to think about worst case for hacking). But as a rule of thumb, with a fast language (C/C++) a computer can do 10^8 or 10^9 computations a second.
•  » » 21 month(s) ago, # ^ |   0 Simple and clear solution in 3 steps :1. find all divisors of n greater than or equal to 2.2. brute force the divisors using 3 loops and check whether you can get those 3 numbers say a,b,c such that a*b*c ==n and a!=b && b!=c && a!=c .If you got these 3 numbers then flag = true and break from all three loops.3.If flag is true then print yes and a,b,c else print no . for further reference see my code by clicking on C.cpp : C.cpp
•  » » » 21 month(s) ago, # ^ |   0 Yeah!
•  » » 21 month(s) ago, # ^ | ← Rev. 4 →   0 Greedy approach; let sq = sqrt(n) iterate i from 2 to sq, if n is divisible by i, store i in vector then divide n by i. Outside loop,if the vector size is 2 while looping, instantly break. if vector size < 2, print false. Else check if n(after loop) is not equal to numbers we push to vector and not equal to 1. If false then no, or else the answer is 2 numbers in vector and n that we get after looped.69322228
•  » » 21 month(s) ago, # ^ |   0 The initial observation is 2*3*4 is the minimum value from which we can have valuable answers .After skipping those , my idea is to find two numbers a,b such that a*b = n . Then find two numbers i,b such that b%i==0 and i!=a so that we can assign value of i to b and (b/i) to c . #include #include #define int long long #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); using namespace std; int32_t main() { fast; int t; cin >> t; while(t--) { int n; cin >> n; if(n<24){ cout<<"NO"; } else{ vectorv; int a=0,b=0,c=0; for(int i = 2 ; i
 » 21 month(s) ago, # |   0 How do you lock your submission? I could not see the lock icon anywhere on the dashboard for the problems I solved.
•  » » 21 month(s) ago, # ^ |   +2 Submissions ran on system tests directly, so there are not pretests and options related to, like hacks and locking problem
•  » » » 21 month(s) ago, # ^ |   0 So for this contest there was no hacking phase? Sorry to ask stupid questions but I am new to this.
•  » » » » 21 month(s) ago, # ^ |   0 Just like me boy!
•  » » » » » 21 month(s) ago, # ^ |   0 Why does it say "and after the round it will be a 12-hour phase of open hacks" in the blog?
•  » » » » » » 21 month(s) ago, # ^ |   0 Pal, it seems that I'm wrong too!
 » 21 month(s) ago, # |   -16 Since I'm not an old user of codeforces, it's the first time that I experienced something like this(tooooo long quotes). I think it's not right to blame CF, 'cause I'm sure that these kind of issues are not more than fingers of hand through CF history. Any way #unrate_615
 » 21 month(s) ago, # | ← Rev. 2 →   0 how many number of divisors number has in problem c. In worst case.
•  » » 21 month(s) ago, # ^ | ← Rev. 2 →   0 Try number 734033887
•  » » » 21 month(s) ago, # ^ |   0 It works for 30. which has 3 distint divisors 2,3,5
•  » » » » 21 month(s) ago, # ^ |   0 srry. My mean was this case divisor of 734033887 are : {1, 5009, 146543, 734033887}; if we take 5009, 146543 as first and second value , we don't have 3'rd option to take instead of 1 which is < 2
•  » » » » » 21 month(s) ago, # ^ |   0 thanks for clarification.
•  » » » » 21 month(s) ago, # ^ |   0 You have missed the case where there are only two primes and both of their power is 2. For example : 36. Your code returns NO. But there is an answer : 2, 3, 6
•  » » 21 month(s) ago, # ^ |   0 Haven't completely checked your code but you over-complicated the problem while the constraints aren't that big.
•  » » » 21 month(s) ago, # ^ |   0 I simply do prime factorization of number.
•  » » 21 month(s) ago, # ^ |   0 Try 1 36Answer exists 2, 3 and 6
•  » » » 21 month(s) ago, # ^ |   0 Got my mistake thanks.
 » 21 month(s) ago, # |   0 What is the 11th test in D? Why did my program fail it?
 » 21 month(s) ago, # |   +4 My approach for E: Process each column separately .For every column calculate cost for every possible rotation. For calculating the cost of every rotation loop through every value and find out for which rotation this element is at its correct position,and decrement the required no. of operation for that particular rotation by 1 .Choose rotation which require minimum operations .
 » 21 month(s) ago, # |   +7 Thanks for the contest!
 » 21 month(s) ago, # |   +12
•  » » 21 month(s) ago, # ^ |   0 when the spec is out of bounds lol
•  » » 21 month(s) ago, # ^ |   +5 Many people failed on test 25 because of it
 » 21 month(s) ago, # |   -14 guys i know that my question is not related to the constest, but how can I figure out users that I'm in their friends?
•  » » 21 month(s) ago, # ^ |   0 you can't
 » 21 month(s) ago, # |   0 Can someone help me understand where I went wrong in Problem C. My Solution Thanks in advance
•  » » 21 month(s) ago, # ^ | ← Rev. 2 →   +8 Your code is too long,I think you should learn to write concise code
 » 21 month(s) ago, # |   0 How to solve D?
•  » » 21 month(s) ago, # ^ |   0 I use std::set to matain the answer, and the code is pretty short and clear, here's my submission:69350130.
•  » » 21 month(s) ago, # ^ |   0 even shorter code by maintaining the count of remainders
•  » » » 21 month(s) ago, # ^ |   +1 I have absolutely the same code, and, this solution looks amazing...
•  » » » » 21 month(s) ago, # ^ |   0 cheers mate
•  » » » 21 month(s) ago, # ^ |   0 Isn't this TLE?
•  » » » » 21 month(s) ago, # ^ | ← Rev. 2 →   0 it's O(qlogx).
•  » » 21 month(s) ago, # ^ |   0 I did something stupid but the key idea is that the values only matter mod x. So we keep counts of 0 to x-1 mod x. The MEX can be computed greedily by trying to increment MEX and decrementing counts as we go.
•  » » 21 month(s) ago, # ^ | ← Rev. 2 →   0 D was simple but little tricky for me. Let's say dp[i] contains what is the max MEX value till ith query. and let's say it is K;Now since dp[i]=K, it implies that we were unable to generate K from previous numbers till now. So for the (i+1)th query_number we will try to generate the Number K onwards(including it) so that our max value of MEX become greater than previous and best possible till now.Now lets say K=ax+r so K can be generated iff there exist a query_number previously of the form Z=bx+r so that you can just add or subtract +/-(a-b)x to Z depending on whether a>b or b>a in order to get K.SO you can feel now that there is no need of actual query_number n... we just need n%x — remainder. so just create array of size x. and play with remainder... Here is code Spoilerint q=s.nextInt(),x=s.nextInt(); int[] dp=new int[x];int i=1,pre=0; while(q--!=0){ dp[s.nextInt()%x]++; for(int j=pre;j0){dp[pre%x]--;pre++;} } i++; out.write(pre+"\n"); } My_submission
•  » » 21 month(s) ago, # ^ | ← Rev. 2 →   0 Maintain array $B$, indexed from $[0, x)$. Initially, $B[i] = i$.For each query, do $B[y_j \text{ mod } x] \text{ += } x$. The answer after each query is the minimum value of $B$; however finding the minimum naively would be too slow ($O(qx)$ over all queries). We could use a segment tree, or even just an ordered set (for each query, remove $B[i]$ from the set, update $B[i]$, then add it back to the set. $B$'s values would always be distinct), to reduce it to $O((x + q) \log x)$, which should pass. Do be careful about overflow; either use 64-bit integers or stop updating an index if it exceeds a threshold $> q$.This works because it is always optimal to change each $y_j$ to the minimum possible non-negative value not already in $A$ (the array in the problem description), and $B[i]$ represents the minimum non-negative value $b$ where $b \text{ mod } x = i$ and $b \notin A$.
 » 21 month(s) ago, # |   -6 How to solve D?
•  » » 21 month(s) ago, # ^ |   0 The question becomes easy when you observe that a number when added to x or subtracted to x, it's modulo w.r.t 'x' remains the same.Now, you just need to maintain precomputed of first % 'x' numbers, i.e from 0 to x — 1.Let's say this array as 'a'. Now, whenever a number comes. Find its modulo w.r.t 'x', and maintain a map or set, to check whether that number has come before.if you use this number, let's say y. then increase that number in your precomputed array i.e a[y] += x.Why? Because whenever a number will come, it will be holding place for next place of that modulo multiplicity. I tried my best to explain to you. Take a look at my submission, you will get more idea.My Submission
•  » » » 21 month(s) ago, # ^ |   0 What is the time complexity of your solution in worst case?
 » 21 month(s) ago, # |   0 How to try on the hack? Its showing Illegal contest ID on clicking on 'Hack it!'
•  » » 21 month(s) ago, # ^ |   -8 I think there's no hacking phase. 'cause the solutions ran on system tests directly, and not pretests
•  » » » 21 month(s) ago, # ^ |   +5 On div3 there is always a 12-hour hacking phase
•  » » » » 21 month(s) ago, # ^ | ← Rev. 2 →   0 Oh, so you do not need to LOCK your solution in Div3.
•  » » » » » 21 month(s) ago, # ^ |   0 Locks are available in div1/div2 contests, not in div3 contests. You can read the rules of div3 to get more information
•  » » 21 month(s) ago, # ^ |   0 to hack in div 3 open the solution of whom you want to hack and on the top right by clicking on "hack it" you will be directed to test case window where you can put the hack test case.
 » 21 month(s) ago, # |   0 when will editorial come
•  » » 21 month(s) ago, # ^ |   0 Presumably sometime after the 12 hour hacking phase ends
 » 21 month(s) ago, # |   0 Who can explain to me why in my solution to Problem D I have to use long long.
 » 21 month(s) ago, # |   +3 Where it is mentioned in problem D that we can increase or decrease one element in an operation more than once?? I mean a[i]-m*x or a[i]+m*x is possible for m>1 also in one single operation????
•  » » 21 month(s) ago, # ^ |   0 In the notes describing the example
•  » » » 21 month(s) ago, # ^ |   0 You mean in the explanation??
•  » » 21 month(s) ago, # ^ |   +4 They didn't say you have to do only one operation. You can do operation as many times as you want.
 » 21 month(s) ago, # |   +2 Very similar to Problem F ?
•  » » 21 month(s) ago, # ^ |   +5 Yes and the author is my teammate sonu628. Unfortunately I couldn't solve it. ;_;
•  » » » 21 month(s) ago, # ^ | ← Rev. 2 →   0 Never mind, I could not solve it either, even after solving it in the contest. I assumed the diameter of a linear tree = n (thus WA 39) :(
•  » » 21 month(s) ago, # ^ |   +4 Didn't expect someone will remember :)P.S:- feeling happy ;)
 » 21 month(s) ago, # |   +4 Hacks for C?
 » 21 month(s) ago, # |   +3 In problem F, what is wrong with this approach? First, I find a diameter and choose a and b as the ends of that diameter. Then, I banned every edge between a and b and create the new graph. After that, I run DFS from every vertex between a and b. Finally, I choose c as the vertex whose depth is higher (depth 0 is also considered, in that case c is between a and b). This was my submission.
•  » » 21 month(s) ago, # ^ |   -6 I didnt read your code but your approach is O(n^2) you can simply do a multisource bfs.
•  » » » 21 month(s) ago, # ^ |   +1 Once I have erased the edges between the nodes in the diameter, I have a forest in which I have a tree rooted on each node and running DFS from them is O(V + E)
•  » » » 21 month(s) ago, # ^ |   +1 Can you please explain your Multi-Source BFS Approach ?
•  » » » » 21 month(s) ago, # ^ |   0 Its also basically the bfs, but initially in queue you have to put all the nodes whose distance is initially 0, also make their distance 0 initially. Now in the while loop instead of queue having a single node it will have many nodes with distances 0. The time complexity is same since it traverses whole graph, maintaining correct distances i.e O(V+E) .Now in this particular question after finding the diameter ends,for all the nodes in their path make their distance 0, and run multi-sources bfs to get the third node which is farthest from the path.
•  » » 21 month(s) ago, # ^ | ← Rev. 2 →   0 TRY this case:12 111 22 33 41 55 66 71 88 99 108 118 12I think the answer is 9 but your approach will give 10.
•  » » » 21 month(s) ago, # ^ |   0 please ignore. my bad. your approach will also give 9
•  » » » » 21 month(s) ago, # ^ |   0 Don't worry, thanks. I got AC. The approach was right, I had a bug of using the name of the variable temp instead of diameter in my loop.
 » 21 month(s) ago, # |   -10 69357392 I know my code is not that clean, but please check it for my bug on B!
•  » » 21 month(s) ago, # ^ |   -10 anyone!? ;_;
•  » » » » 21 month(s) ago, # ^ |   0 sorry I didn't read the B, btw what is compatriot?
•  » » 21 month(s) ago, # ^ |   0 Irrelevant comments: checking bounds, n=1 case, and ans=="YES" is not needed. The points can be sorted destructively. Once points are sorted lexicographically we can perform the yes/no check with one coordinate. Between two points you only need some Rs followed by some Us. idk what the last output R is.
 » 21 month(s) ago, # |   0 In problem D, what does "in one move" mean? It means increase or decrease any element of the array only one time or any? I asked my friend after contest, he said any. Did i forgot something?
•  » » 21 month(s) ago, # ^ |   0 One move means increase/decrease one element once, but since they give you unlimited moves, you in effect can do unlimited increases/decreases.
•  » » » 21 month(s) ago, # ^ |   0 I mean why unlimitedly moving not declared in detail?
 » 21 month(s) ago, # |   +1 Approach for D?
•  » » 21 month(s) ago, # ^ |   0 Just count remainder of X.
•  » » 21 month(s) ago, # ^ |   0 simplest way I can think to explain D #include #include using namespace std; typedef long long int ll; int main() { ll q,x,i,j,k,l,m,o,p,t; cin>>t>>x; set> se; for(i=0;i mp; while(t--) { cin>>i; l=mp[i%x]; se.erase(make_pair(l,i%x)); mp[i%x]++; se.insert(make_pair(mp[i%x],i%x)); // cout<<(*(se.begin())).first<<(*se.begin()).second<<"dekh le\n"; cout<
•  » » » 21 month(s) ago, # ^ |   0 Exactly same as mine :)
 » 21 month(s) ago, # |   0 I really liked this Div 3 round. Especially how Mathematical C and D were. And that there were only 6 distinct problems.
•  » » 21 month(s) ago, # ^ |   +1 Agreed, I come from Project Euler background so it is familiar
•  » » » 21 month(s) ago, # ^ |   0 Great. How many problems did you solve on Project Euler ?
 » 21 month(s) ago, # |   0 Is there anyone else with E failing on Test 8 ?
 » 21 month(s) ago, # |   0 how to solve E? I heard that it is greedy, but i can't understand. Why greedy works? :(
•  » » 21 month(s) ago, # ^ | ← Rev. 2 →   0 while traversing in each column(say j), if any element(x) is found which belong to column j in the final matrix. Then find no of moves required in the cyclic shift of this column so that x reaches to its correct position. Maintain a map[mv,fre]mv: no of moves required so that x reaches to its correct position in the cyclic shift.fre: frequency of such elements which reaches to its correct position after mv moves in the cyclic shift.Now, for each column min no of moves required(say min_col) is the n-max(difference between freq and mv). So the ans is sum of all min_colFor better understanding have a look
 » 21 month(s) ago, # |   0 can somebody help me with the testcase on which my soln is failing
•  » » 21 month(s) ago, # ^ | ← Rev. 4 →   +3 your code is printing 0 which is not allowed
 » 21 month(s) ago, # |   0 hello all. My code for problem C gives the wrong answer on test case #2. Here is what I am doing: a) Find the "first" divisor of n greater than equal to 2. b) Find the "second" divisor which is not equal to the first divisor if possible. c) If possible then check if n/(first*second) is >= 2. d) If not possible then there is only one divisor >= 2 of n except itself. Then choose "second" = (first*first) and check if triplet is possible.Please Help!![submission:69361400]
•  » » 21 month(s) ago, # ^ |   +5 Sure, try $100$ as test case. According to your code, your first divisor is $2$ and the second one is $4$, so you check if $4$ divides $50$ and that gives you NO, you should choose a divisor after extracting the previous one. Also, your code is $O(t*n)$ and $n \leq 10^9$ and $t \leq 100$, so it will give you TLE.
•  » » » 21 month(s) ago, # ^ |   0 Thank you
 » 21 month(s) ago, # |   +1 what is the hack for C ?
•  » » 21 month(s) ago, # ^ |   0 Idk, but maybe it's due to the timeout since most of the hacked code got over 1900ms...
 » 21 month(s) ago, # |   0 What is test case 8 in E??
 » 21 month(s) ago, # |   0 hi guys can anyone tall me how to solve C? I don't understand why it always is optimal to try first divisor of n
•  » » 21 month(s) ago, # ^ |   0 find all prime factors with their respective powers in sqrt(n) time then check three cases case 1. no. of prime factors are more than3 answer always exist and it is any combination you can pick up then case 2 only 2 prime factors but their total power is greater than or equal to 4 then answer exist else no. (a,b,a^x*b^y)case 3 only 1 prime factor available then check if its power>=6 (a,a^2 a^3) then answer always exist else no.
•  » » » 21 month(s) ago, # ^ |   0 I also wrote my solution based on same logic, except that I was considering for case 2 that the sum of powers should be greater than equal to 3
•  » » 21 month(s) ago, # ^ |   0 We just need to find 2 different divisors such that one of them is a composite one with again 2 different divisors and also you need to check that they are greater 1.
•  » » 21 month(s) ago, # ^ |   0 hmmmm you can list all of divisors of N, the max numbers of divisor of N is 100 (if N == 1e9) so you can use O(N^3), right? Use 3 loops and check every divisor by conditions of problem
•  » » » 21 month(s) ago, # ^ | ← Rev. 2 →   0 Not exactly n³ because no. Of divisors are way to less for numbers <= 1e9.Its not 100 but around 1700-1900 i guess
•  » » » » 21 month(s) ago, # ^ | ← Rev. 2 →   0 you can check it! numbers of divisors of 1e9 is 100, I tried it before I wrote my solution
•  » » » » » 21 month(s) ago, # ^ | ← Rev. 2 →   0 Any number less than 1e9 has not more than 1344 divisors, with 735134400 having exactly that many. Actually, it is reasonable to estimate the number of divisors as cbroot n for small numbers (even though it asymptotically grows slower than any polynomial).
•  » » » » » » 21 month(s) ago, # ^ |   0 Maybe you don't understand what I say :(
•  » » » » » » » 21 month(s) ago, # ^ |   0 Maybe that's the reason but this logic works right XD
 » 21 month(s) ago, # |   0 Guys, I am confused about the Problem D. In the example it states that: "After the fourth query, the array is a=[0,1,2,2]: you don't need to perform any operations, maximum possible MEX is 3 (you can't make it greater with operations)." __ However, if we add one to the last element will get a=[0,1,2,3] which I think has a MEX of 4. Can someone explain me why adding one to the last element does not improve the MEX?
•  » » 21 month(s) ago, # ^ |   +9 You can add only number x. In this testcase x equals to 3, so u cant add 1, u can add only 3 as many times as you want
•  » » » 21 month(s) ago, # ^ |   0 Thanks man, I totally overlook such requirement.
 » 21 month(s) ago, # |   +3 Whats testcase 3 of problem F?
•  » » 21 month(s) ago, # ^ |   0 This testcase worked for me: Input10 5 8 5 2 8 9 8 6 8 7 5 3 8 10 9 1 7 4  Output6 1 2 4 
 » 21 month(s) ago, # |   +3 No hacking in this Round? I am getting Illegal contest ID.
 » 21 month(s) ago, # |   0 any idea to solve problm D please ?
 » 21 month(s) ago, # |   0 when will be editorial will be up?
 » 21 month(s) ago, # |   0 When the ratings will be updated?-
 » 21 month(s) ago, # | ← Rev. 3 →   +1 Whoops, looks like I submitted a solution for 1294E - Obtain a Permutation that has an error in it not covered by the testing suite, but it's too late to hack it: 69397747 Spoilera <= n * m should be a < n * m. It breaks on the following test case: 4 4 17 18 19 20 17 18 19 20 17 18 19 20 17 18 19 20 
•  » » 21 month(s) ago, # ^ |   +3 I have hacked it now with the sample you provided
 » 21 month(s) ago, # |   +5 I think I am the only one who solved C via Miller-Rabin.It proves that it is no use to think the problems as too difficulty in div3 rounds
 » 21 month(s) ago, # |   -7 I have created the video solution for the first four problems, explaining my understanding and approach for the same. Codeforces 615 DIv3 Video editorialsDo like comment, share, subscribe if you like the video. Do subscribe for more such contentHappy Coding
•  » » 21 month(s) ago, # ^ |   -6 Man are ducking serious, first four problems are super easy, there is no need to make a whole video explaining them. Besides why didnt you explain all the problems? Are they too tough for you?
 » 21 month(s) ago, # | ← Rev. 2 →   +4 I think your test cases for 1294E - Obtain a Permutation is too weak. 69353056 Shows: Output: 0 For Input: 4 4 5 2 3 4 Where the actual result is: 1
 » 21 month(s) ago, # |   +4 Huge gap between next contest....... Please decrease the gap
 » 21 month(s) ago, # |   -10 I got a mail from codeforces because my submission matched with someone.I am giving you a guarantee that it became co-insidently.i saw this code(question B) before in my collage fest at DAIICT,Gandhinagar,India.So please give me rating of my codes. thaks...........
•  » » 21 month(s) ago, # ^ |   -12 Sahil_M is also my collage mate and he was also there in fest.so co-insidently this thing happened.
 » 21 month(s) ago, # |   -8 I am sorry I participated in the round with 2 personal users (7ouda,7ooda) and I don't know that it's rules violation.
 » 21 month(s) ago, # |   -11 Hi dear,I participated in Codeforces Round #615 (Div. 3) with my 2 personal handle (7ouda,7ooda) and submitted same solutions so my submissions was skipped, and I didn't know that it's a rules violation, so please can you help me.Thanks, Mahmoud.
•  » » 21 month(s) ago, # ^ |   0 Write it here.
•  » » » 21 month(s) ago, # ^ |   0 Thanks