### Vovuh's blog

By Vovuh, history, 12 days ago, translation, ,

<almost-copy-pasted-part>

Hello! Codeforces Round #579 (Div. 3) will start at Aug/13/2019 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 Mikhail PikMike Piklyaev, Maksim Ne0n25 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>

UPD: Editorial is published!

• +139

 » 12 days ago, # |   0 Auto comment: topic has been translated by Vovuh (original revision, translated revision, compare)
 » 12 days ago, # |   -45 I hope it will be a good contest!
 » 12 days ago, # |   -34 I hope this round will rebuild our shattered hope on easy rounds.
•  » » 11 days ago, # ^ |   -14 This is QUALITY comment how could anyone dislike it?
•  » » » 11 days ago, # ^ |   +13 Teacher: What is most available free stuff in the world?Student: CF downvote, Sir!
 » 12 days ago, # |   -29 I love Div. 3 rounds. I eagerly wait for it.
 » 12 days ago, # | ← Rev. 3 →   -14 Div3! Long time no see!
 » 12 days ago, # |   -12 Best wishes to everyone!
•  » » 12 days ago, # ^ |   -8 thanks
 » 12 days ago, # |   -8 Vovuh's rounds are always good!
•  » » 11 days ago, # ^ |   +5 How do you know??. You've never participated in any of his rounds.
•  » » » 11 days ago, # ^ |   +1 we all know, not only him.
•  » » » 11 days ago, # ^ |   +9 I wrote his problems on Vjudge.
 » 12 days ago, # |   -25 Good luck everybody =)
 » 12 days ago, # | ← Rev. 3 →   -34 After this contest my final exam will be started....But I will keep doing contest
 » 11 days ago, # |   +114 Best ways to increase your contribution :)
•  » » 11 days ago, # ^ |   -34 That means It's also a tricky part... You guys makes me disappinted..
•  » » 11 days ago, # ^ |   -82 The comment is hidden because of too negative feedback, click here to view it
•  » » 11 days ago, # ^ |   +8 and make a memes for contribution guys XD
 » 11 days ago, # |   -23 Thanks MikeMirzayanov for adding Diagnostics Hint feature on RE.
•  » » 11 days ago, # ^ |   0 Sorry to disappoint you but the diagnostic hint is disabled in contests.
 » 11 days ago, # |   +42 This is participants attending this contest at night 24:00.
•  » » 11 days ago, # ^ |   0 I think I will become one of the cods :(
 » 11 days ago, # |   +16 Will the downtime of polygon affect us? Will there be testing in the contest?
•  » » 11 days ago, # ^ |   +8 don't worry, it is fixed.
 » 11 days ago, # |   +68 I didn't do much with my youtube channel recently because I was busy with summer schools and stuff, and this is bad for publicity :)So I guess I will do screencast with English commentary for this round and I'll try to go more in depth about solutions. That is, if Mike and team will fix Polygon. Hope to see you on the channel!
•  » » 11 days ago, # ^ | ← Rev. 2 →   -25 deleted
•  » » » 11 days ago, # ^ |   +30 After the contest, of course. This round is rated for many people.
•  » » » » 11 days ago, # ^ |   0 it seems that Polygon is fixed, at least temporarily.
•  » » 11 days ago, # ^ |   0 Thanks.
 » 11 days ago, # |   0 Is there any negative point for the unsuccessful hacking attempt during the 12 hours of hacking period?
•  » » 11 days ago, # ^ |   +1 No. And no positive point for successful hacking attempt either.
 » 11 days ago, # |   +49 Unfortunately there is an issue with CF-Predictor and it will not be available during coding phase of this contest. CF-Predictor is going to be back after 22:00 UTC today.I'm very sorry for the inconvenience.
•  » » 10 days ago, # ^ |   +1 Any update ?
•  » » » 10 days ago, # ^ |   +9 It's working again!
 » 11 days ago, # |   -11 Me before Contest : second thing don't tell what you think I will be I'm the one at the sail I'm the master of my seeeeooh oooh After Contest : Paaaaaain you made a you made a believer
 » 11 days ago, # |   -15 i need to increse my rating !! hope this round helps:)
 » 11 days ago, # |   -13 No stress Happy round
 » 11 days ago, # |   +117
•  » » 11 days ago, # ^ |   +2
 » 11 days ago, # |   0 Long queue times anyone? Sorry posted previous comment in russian :C
 » 11 days ago, # |   +3 Oh my god! Queueueueueueforces
•  » » 11 days ago, # ^ |   +3 Please, do not be Codeforces Round #536 (Div. 2)
 » 11 days ago, # |   0 The system is not allowing me to submit even a single solution. It is always showing "You have submitted exactly the same code before". please help!!
•  » » 11 days ago, # ^ |   0 It means that the the solution has been submitted. You don't have to submit again.
•  » » » 11 days ago, # ^ |   0 It was showing that for different code. I only was able to submit on m2 then.
 » 11 days ago, # |   -21 Thanks for the round. It sucks. Can u fix your servers pls, the submission was in queue for about 7 minutes. Make it unrated or increase the time. Thanks
•  » » 11 days ago, # ^ |   +18 Please be patient, they said they are fixing it, besides it's happening with all of us.
•  » » 11 days ago, # ^ |   0 You have not even submitted anything. Another fake account ?
•  » » 11 days ago, # ^ |   0 To solve problems or for learning from this platform, we don't need to pay anything. It's totally opensource. This community help us with many things. Imagine the number of submissions per moment. It's pretty obvious that there will be problems sometime. Just be patient.
 » 11 days ago, # |   0 contest should be unrated i submited my solution 12 mins ago
 » 11 days ago, # |   0 Queueforces Div3
 » 11 days ago, # |   0 I am back on code forces after a year, and it still hangs a lot :P
 » 11 days ago, # |   0 I use gmail for codeforces. How can i enter in codeforces2?
•  » » 11 days ago, # ^ |   0 Yes I also need to know something about this ; If anyone can help...?
•  » » » 10 days ago, # ^ |   +5 use "Forgot your password?" option in login window to create a password on codeforces.com. You could then use this to login to m2.codeforces.
•  » » » » 10 days ago, # ^ |   +6 thanks, man
•  » » » » 10 days ago, # ^ |   +3 Thanks...!
 » 11 days ago, # |   +17 MY CUR PING : 600000 ms and it keeps on increasing :/
 » 11 days ago, # | ← Rev. 4 →   +17 MY CUR PING : 600000 ms and it keeps on increasing :/ UPDUPD: Ping is the reason of my same two comments
 » 11 days ago, # |   -14 pls make it unrated!!!
 » 11 days ago, # | ← Rev. 3 →   0 Contest extended by 20 minutes, but the situation that has already happened cannot be reversed. It's not good for successful contest. :(
 » 11 days ago, # |   -16 make this round unrated
 » 11 days ago, # |   +3 Wondering what happens if you hack a solution, and it gets compilation error.
•  » » 11 days ago, # ^ |   -8 Woah, example please ?
 » 11 days ago, # |   +24 Me waiting for the verdicts.
 » 11 days ago, # | ← Rev. 4 →   -13 deleted
 » 11 days ago, # |   0 Is there a solution in python that runs in time for D2? If not, then why support it at all! frustrated ^^ The problem was very nice to think about, thank you — I am curious what I did wrong...
•  » » 11 days ago, # ^ |   0 there is. check mine https://codeforces.com/contest/1203/submission/58739316
•  » » » 10 days ago, # ^ |   0 thank you for your reply, I see; at least my idea was the same.Hm, that's not a python solution, it's a C solution written in python :-) I tried using str.index() etc, but this seems less performant, strange, I thougt builtins should be better than loops...
•  » » » » 10 days ago, # ^ |   0 I also would guess that str.index() is would be faster than a loop. Just checked your solution at https://codeforces.com/contest/1203/submission/58751526 The runtime is |s| * |t| so it is not optimal. It's not because of python. :)
•  » » 10 days ago, # ^ |   0 I also solved it in Python, so yes, there is.
 » 11 days ago, # |   +2 For F1, cant we greedily first choose all projects that give some positive delta ordered by rating requirement, followed by tasks that give as small negative delta as possible, but not if it makes it impossible to do the project with largest rating requirement?
•  » » 11 days ago, # ^ |   0 Same question here !
•  » » » 11 days ago, # ^ |   0 When you choose projects with negative delta, some project might have large delta as well as large rating requirement. example test case - 2 400 180 -5 399 -100
•  » » » » 11 days ago, # ^ |   0 So, in your example, it's impossible to do the project with largest rating requirement if I choose the project which largest negative delta. So, I choose the second project before first project.I failed TC 11, and my answer is YES when correct answer is NO. I don't get how I'm finding a solution when it doesn't exist ;_;
•  » » 11 days ago, # ^ |   0 In F1 you do first the ones with positive reward, then the ones with negative. If that does not work answer is NO.
•  » » » 11 days ago, # ^ |   0 This is not the complete solution, but kind of the basic idea. I have the same.
 » 11 days ago, # |   0 What is TC 37 in F1 ?
•  » » 11 days ago, # ^ |   +3 not offical2 301 10 -1 300 -300
•  » » » 11 days ago, # ^ |   +1 in my case ，，if you solve it greedily，，it will WA
•  » » » » 10 days ago, # ^ |   0 Thanks, that's exactly the problem with my idea/submission
•  » » » » 10 days ago, # ^ |   0 Thank you fengjk Can you give me a hint to solve F1 ?
 » 11 days ago, # |   0 What is the test case #37 problem F1?
 » 11 days ago, # |   +66 Sorry for slow website and judge queue. I think it was the first major queue during the last months. Actually, I do not understand the reason for now: is it because of too heavy tests + easy problems or there is another reason. I'll investigate it. I'm doubly upset because I was thinking about ideas for these problems for several days (it seems that all ideas belong to me). I hope you enjoyed the problems!
•  » » 11 days ago, # ^ |   +40 Even though it queued a bit in between, it turned out to be a good contest. At least for me, I enjoyed it.
•  » » 11 days ago, # ^ |   +16 Really enjoyed the problems, Thanks a lot
•  » » 11 days ago, # ^ | ← Rev. 2 →   0 Hello... I login into codeforces using the gmail account ; but it was not there on the alternate version of the website ( The light version ) ... Is there someway of login on that light version for people who login there accounts using gmail...? Please suggest ; thanks in advance...!Edit : Got it...! Thanks...!
•  » » 10 days ago, # ^ |   +16 Are you feeding the hamster properly?
 » 11 days ago, # | ← Rev. 3 →   0 Upd: now I got what is the problem with C. Can you tell me what is wrong with other ones?Can someone please tell me why I got WA on all of my submissions in this contest? (except A)https://codeforces.com/contest/1203/submission/58755675https://codeforces.com/contest/1203/submission/58763681https://codeforces.com/contest/1203/submission/58744361https://codeforces.com/contest/1203/submission/58770060
•  » » 11 days ago, # ^ |   0 In C elements up to $10^{12}$ you must use long long
•  » » » 11 days ago, # ^ |   0 Thanks, but in line 29 I have #define int long long
•  » » » » 11 days ago, # ^ |   +1 Maybe t = gcd(tmp, t)
•  » » » » » 11 days ago, # ^ |   0 yeah, thanks
 » 11 days ago, # |   0 What is testcase 33 in D2?
 » 11 days ago, # | ← Rev. 3 →   +3 Failed to solve a QUEUE question in interview this morning, and now CF is showing me QUEUEEEEEEEEE. God's pun game is strong :(Could have made WA to AC if it wasn't QUEUEEEE, this is frustrating..
•  » » 11 days ago, # ^ |   0 Hardluck++
 » 11 days ago, # |   0 I think the order should have been C-A-E-B-D-F, but I suppose it doesn't really matter in Div 3 contests.
 » 11 days ago, # |   0 how to solve F2? I spent 2 hours thinking :( . Is there some standard algorithm?
•  » » 11 days ago, # ^ |   +6 First do the ones with positive reward, then most possible ones with negative reward by knapsack.
 » 11 days ago, # |   +4 in queue:)
 » 11 days ago, # | ← Rev. 3 →   -6 R.I.P QUEUEFORCES
 » 11 days ago, # |   0
 » 11 days ago, # |   +2 36 hours hacking phase?
 » 11 days ago, # |   +24 F2 is similar to Problem I in NWERC2017.
 » 11 days ago, # |   0 why is the open hacking phase of 36 hrs??
•  » » 11 days ago, # ^ |   +19 It is a mistake, it will 12 hours. I'll fix it ASAP.
 » 11 days ago, # |   +14 this contest — queue = PERFECT!!
 » 11 days ago, # |   +1 Why the duration of open hack is 36 hours, not 12?
 » 11 days ago, # |   0 Why does the timer for open hacking (https://codeforces.com/contest/1203/standings) say that the open hacking phase lasts over 35 hours?
 » 11 days ago, # |   0 still 36 hours open hacking?
•  » » 11 days ago, # ^ |   +9 see it fixed. we should be patients
 » 11 days ago, # |   +12 Contest was nice.
 » 11 days ago, # |   -34 This contest should get unrated. I had to wait for a long time to see the whether the test cases passed or not. This wasted a lot of time of mine.
•  » » 11 days ago, # ^ |   -16 Fully agree with you
• »
»
»
11 days ago, # ^ |
-19

# +1

even though I didn't take part in it

•  » » 10 days ago, # ^ |   +14 I think, you should solve further tasks instead of waiting verdicts
•  » » 10 days ago, # ^ |   +4 Next time you should work on other problems while it is testing, so you are not wasting any time.
 » 11 days ago, # |   +7 it seems Dsiv.3 always have a huge number of participations this round have a 13216 participations, which I think is one of the most participations in contests. maybe it should increase the number of Div.3?
•  » » 10 days ago, # ^ |   +8 Increasing the number may cause the quality goes a little bad. Plus, there is once-a-week Educational rounds.
 » 11 days ago, # |   +21
 » 11 days ago, # |   0 How to use m2.codeforce?I only use the auto?(one click?) login of Gmail.
•  » » 11 days ago, # ^ |   0 You need to set new password with "Recover password" link.
•  » » » 11 days ago, # ^ |   0 Thanks!! m2 is simply cool~~
 » 11 days ago, # | ← Rev. 2 →   0 I'm getting WA on test case 18 in problem D2. Could someone help me to figure out what is going wrong. This is my submission 58778018. Thanks in advance.
•  » » 10 days ago, # ^ |   0 Replace else in last for with if (i < n - 1), because there is a case, where removing substring is between $pre[0]$ and $suff[1]$.
 » 10 days ago, # |   0 how to solve f1 ??
 » 10 days ago, # |   0 Does the hacking in hacking phase gives points?
•  » » 10 days ago, # ^ |   +5 no
 » 10 days ago, # |   0 Why does my submission TLE, it is O(n*n), it should work totally fine in 2s as n is 100, my submission is submission
 » 10 days ago, # |   +6 How to sort the input in optimal order in F2 ?
 » 10 days ago, # |   0 In question C I got TLE in this submission 58730683 and pretest passed in this 58757237 can anyone explain why ??????
•  » » 10 days ago, # ^ |   0 Maybe it's because of the time it takes your gcd function to go from one step to the other
•  » » » 10 days ago, # ^ |   0 I also got TLE in test 5 during the constest. I used faster input methods and got AC. As you can see your solution ran in 850 ms, which is just a bit below TLE.
•  » » 10 days ago, # ^ | ← Rev. 2 →   0 In the second loop, i*i can reach 10^12 which won't fit into int, I changed int to long long and resubmitted your solution and got it accepted.
 » 10 days ago, # |   0 I think the problems are really great, if it not were for the technical issues it might be an excellent contest.
 » 10 days ago, # |   +3 Best ways to get downvotes in a div.3 post:Lv.1 wish a good contest!Lv.2 No broken div.3 again!Lv.5 WTF, this is a div.2 or even div 1.5!Lv.10 See this is good examples of div 3...........Lv.100 This comment is hidden because of too negative feedback, click here to view itLv.999 Please give me upvotes.
 » 10 days ago, # |   0 The common divisor of 2 integers $a, b$ is the divisor of $gcd(a,b)$. I tried to prove in the way.Every integer $x$ can be rewrite under the form of multiple of prime factors: $x = p_1^{m_1} . p_2^{m_2} ... p_k^{m_k}$\$. & $y = p_1^{n_1} . p_2^{n_2} ... p_l^{n_l}$We construct $gcd(a, b)$ by choosing all common prime factors p with the lowest exponent each factor. And, we construct a arbitrary common divisor by choosing some common prime factors with the exponent each factor always less or equal to the lowest (i choosed in gcd).Following this manner, the common divisor of $a, b$ is always divisor of $gcd(a, b)$.
 » 10 days ago, # |   0 I think this Codeforces round is a bit easy, but it's still very good, too. A good writer with a good round.
 » 10 days ago, # |   0 thank to the extend 20 minutes, I can solve the D2 in the last minute. however, waiting for 3 problems' judge is not a good feeling. hope nobody hack me so that i can be an expert this time.
 » 10 days ago, # |   0 How to solve D2 Remove the Substring (hard version)(https://codeforces.com/contest/1203/problem/D2) ?
•  » » 10 days ago, # ^ |   +1 There are 2 cases: 1)Answer — prefix or suffix of string s 2)Consider 2 subsequences: leftmost and rightmost.Assume that we take first i letters from leftmost subs. and the rest we take from rightmost.So you have to check all values such as : rightmost[i + 1] — leftmost[i], and maximize it.
•  » » » 10 days ago, # ^ |   0 I got it. Thank you
•  » » 10 days ago, # ^ | ← Rev. 2 →   0 I like a neat and self-explaining solution (58718869) of D2 by icecuber, by the way. (The idea seems to be the same as index_ proposed.)
 » 10 days ago, # |   -12 is this contest rated??
•  » » 10 days ago, # ^ |   0 Yes.
 » 10 days ago, # | ← Rev. 2 →   0 Can F1/F2 be solved by some Greedy approach? Many solved it by Dynamic Programming. I tried Greedy during the contest but it failed.
•  » » 10 days ago, # ^ |   0 if bi is bigger than 0 then use greedy, add them all if ai is smaller than r. and for left bi which is smaller than 0 use dynamic programming
 » 10 days ago, # |   0 Can someone explain the idea behind problem D?
•  » » 10 days ago, # ^ |   +2 find the rightmost place and the leftmost place in s for each letter in t, then (leftmost[i] — rightmost[i + 1]) for every letter in t, get the max one, that is the answer
 » 10 days ago, # |   0 Problem F is a cleverly disguised "regular bracket sequence" problem. See 1745 on timus.
 » 10 days ago, # | ← Rev. 2 →   +17 Editorial by me incase anyone still needs it:A. Circle of Students explanationRotate the array so that 1 is first. Now we have to check whether (eg. n=5) it is equal to 1,2,3,4,5 or 1,5,4,3,2 solndef solve(N, A): i = A.index(1) A = A[i:] + A[:i] return (all(A[i] == i+1 for i in xrange(1, len(A))) or all(A[i] == N+1-i for i in xrange(1, len(A)))) B. Equal Rectangles explanationConsider the rectangle with the largest side X. Wolog it must be paired with the shortest side Y — otherwise we have X >= A >= Y >= B and so rectangle areas AB = XY >= AB. In particular there are 2 copies of X and Y. We can repeatedly form rectangles in this way. solnfrom collections import deque def solve(A): D = deque(sorted(A)) area = None while D: lo1, lo2 = D.popleft(), D.popleft() hi1, hi2 = D.pop(), D.pop() if lo1 != lo2 or hi1 != hi2: return False elif area is None: area = lo1 * hi1 elif area != lo1 * hi1: return False return True C. Common Divisors explanationConsider the greatest common divisor g of a_1, a_2, ..., a_n. We want the number of divisors this has, which is (e_1 + 1) * (e_2 + 2) * ... * (e_k + 1) if g has prime factorization g = (p_1 ^ e_1) * (p_2 ^ e_2) * ... * (p_k ^ e_k). solnfrom fractions import gcd def solve(A): g = reduce(gcd, A) ans = 1 d = 2 while d * d <= g: e = 0 while g % d == 0: g /= d e += 1 ans *= e + 1 d += 1 + d & 1 ans *= 1 + (g > 1) return ans D. Remove the Substring explanationSuppose we write T = L + R. If i is the least integer such that L is a subseq of S[:i+1], and j is the greatest integer such that R is a subseq of S[j:] then the candidate answer for that split is j-i-1.For every possible split of T, we can find out these i's and j's with a greedy method. solndef solve(S, T): j = 0 ixs = [-1] for i in xrange(len(S)): if j < len(T) and S[i] == T[j]: ixs.append(i) j += 1 j = len(T) - 1 jxs = [len(S)] for i in xrange(len(S) - 1, -1, -1): if j >= 0 and S[i] == T[j]: jxs.append(i) j -= 1 # ixs[t], jxs[t] = "i" and "j" for split of T[:t] and T[t:] return max(j-i-1 for i, j in zip(ixs, jxs[::-1])) E. Boxers explanationThe set of boxers that could be weight 2 is a superset of the ones that could be weight 1. This means that wolog, we should try to make weight 1 boxers first (as it will give potentially free space for boxers with weight 3).Continuing this logic, we can see that we should try to make boxers in order of weight. Also, when trying to make a boxer with some demanded weight D, we should choose in order from lowest to highest weight, since a boxer with weight D-1 can only become weight D, a boxer with weight D could become D or D+1, and a boxer with weight D+1 could become D, D+1 or D+2, so their options are strictly dominated too. solnfrom collections import Counter def solve(N, A): count = Counter(A) ans = 0 for demand in xrange(1, 150002): for d in (demand-1, demand, demand+1): if count[d] > 0: count[d] -= 1 ans += 1 break return ans F. Complete the Projects explanationSeparate the projects (a, b) into 'positive' ones that give rating [b >= 0], or 'negative' ones [b < 0]. We clearly try all the positive ones first, in order from lowest a to highest a.Now, negative projects can dominate each other: for negative projects (a1, b1) and (a2, b2) with a1 > a2 and b1 > b2, we always prefer attempting (a1, b1) first. So we can prove that wolog we should consider the projects in that order. So, sort the negative projects from highest a+b to lowest a+b, and do DP: dp[i][r] is how many projects we can take from neg[i:] with rating r. solndef solve(N, R, projects): pos, neg = [], [] for proj in projects: if proj[1] >= 0: pos.append(proj) else: neg.append(proj) ans = 0 pos.sort() for a, b in pos: if R >= a: R += b ans += 1 neg.sort(key = sum, reverse = True) dp = [[0] * (R+1) for _ in range(len(neg) + 1)] # dp[i][r] : how many projects from neg[i:] with rating r for i in range(len(neg) - 1, -1, -1): for r in range(R, -1, -1): a, b = neg[i] dp[i][r] = dp[i+1][r] if r >= a and r + b >= 0: dp[i][r] = max(dp[i][r], dp[i+1][r+b] + 1) return ans + dp[0][R] 
•  » » 10 days ago, # ^ |   +6 How can we prove that projects should be considered in decreasing order of a+b?
•  » » » 10 days ago, # ^ |   0 By exchange argument (Um_nik's video has pretty good explanation)
•  » » » » 10 days ago, # ^ |   +19 You actually watched this... I don't understand why, but ok, looks like it worth doing :)
•  » » » » » 9 days ago, # ^ | ← Rev. 3 →   0 I came up with knapsack idea but then could not figure out sorting order (I still don't get intuition behind it) and I wrote some really strange thing with bitmasks which worked somehow but I was sure there is simpler solution and there was no editorials so I checked the video. I did enjoy parts I have seen tho, if you're seeking for some feedback :)
•  » » » » » » 9 days ago, # ^ |   +8 Intuitive intuition: Let's look on the process from the end, working backwards in time. We have to have at least $a_{i} + b_{i}$ rating, and now these projects are good (we are going back in time so our rating will increase), and it is obvious that we should do the projects in order of increasing necessary rating (which is $a_{i} + b_{i}$ now).Professional intuition: I'm sure that I should sort the projects according to some rule, so I will write inequalities for exchange argument and see what I get. You can see in screencast that at first I guessed wrong, and even with correct comparator I was unsure until I wrote the inequalities and everything worked out.
•  » » » 10 days ago, # ^ | ← Rev. 2 →   +3 Lets say you have at the moment rating r. And you have (a1, b1), (a2, b2)... (an, bn). Assume we already have ordered set of problems we take (No matter what this order is). Then for each taken project: ai >= r + b1 + b2 + ... + b(i — 1). So you can add to both parts bi and get (ai + bi) >= r + b1 + b2 + ... + bi. So for each i you need ai + bi just not less than some const. That gives us right to assume that if we have correct order then you can take problems in decreasing order of (ai + bi).P.S. There are some flaws I think, but common logic is the same.
•  » » » » 10 days ago, # ^ |   +6 Your inequality is wrong: instead of ai >= r + ... , it should be ai <= r + ... Since we require the current rating to be >= the project requirement.
•  » » » » » 10 days ago, # ^ |   0 Oh thanks. So final inequality is ai + bi <= const. And there is more logic to sort in decrease order.
•  » » » 10 days ago, # ^ |   +10 Let say we have 2 "negative" projects (a1, -b1), (a2,-b2) with b1, b2 > 0 and a1-b1<=a2-b2 and we can successfully complete project (a1, -b1) first follow by project (a2,-b2). Then we can always change the order and successfully do (a2, -b2) first follow by (a1, -b1): + complete (a1, -b1) equivalent to r>=a1 and r-b1>=0. Then do (a2,-b2) equivalent to r-b1>=a2 and r-b1-b2>=0. + complete (a2,-b2) first equivalent to r>=a2 and r-b2>=0. Then do (a1, -b1) equivalent to r-b2>=a1 and r-b1-b2>=0. All these conditions can be followed from above (where r-b2>=a1 because we have r-b1>=a2 and a1-b1<=a2-b2)
•  » » 10 days ago, # ^ | ← Rev. 3 →   0 (ooops... this was already mentioned in the official editorial)For C. Common Divisors (1203C - Common Divisors),prime factorization is not necessary to pass the tests.Alternatively, we can iterate from $1$ to $\sqrt{g}$ (order of $10^6$) and find each possible pair of divisors (58753671).P.S. Thanks for your tutorial!
 » 10 days ago, # |   +3 Can anyone please help me to understand the problem E? I dont understand the problem for a while. It would be really helpfull. Thanks in advance. :)
•  » » 10 days ago, # ^ | ← Rev. 2 →   0 You mean you do not understand the problem statement?We are choosing a subset of the original ($a_1, a_2, ... a_n$) list of weights.We construct another list consisting of the chosen weights.We can modify some of the chosen weights:value $a_i$, if chosen, becomes $(a_i-1)$, $a_i$, or $(a_i+1)$ in our new list.Our task is to choose and modify weights in such a way that all values in our new list are unique.More than that, we should do that so that the size of our new list would be as large as possible.The answer to the problem is the size of a such list.
•  » » » 10 days ago, # ^ |   0 Thanks a lot understood. :)