By tourist, 4 weeks ago, translation,

Hello again!

VK Cup 2021 - Final (Engine) starts very soon: on Aug/22/2021 15:05 (Moscow time). Today, 32 best contestants of the elimination round will be fighting for cash prizes and eternal glory.

You can follow the course of the contest and root for your favorite contestants via this link.

Everyone except for VK Cup 2021 finalists is invited to Codeforces Round #740 (Div. 1, based on VK Cup 2021 - Final (Engine)) and Codeforces Round #740 (Div. 2, based on VK Cup 2021 - Final (Engine)) that start a couple of days later: on Aug/24/2021 17:35 (Moscow time). The rounds will be rated for everyone.

All the problems were authored and prepared by me. Big thanks to everyone without whom this round would not be possible: KAN, PavelKunyavskiy, scott_wu, xiaowuc1, 1-gon, Aleks5d, lperovskaya, MikeMirzayanov. Special thanks to s-quark (2nd place of the first ever VK Cup 2012!) for inspiring problem titles.

You will be given 6 problems and 2 hours 30 minutes to solve them in both divisions. It is recommended to read all the problems. Good luck!

UPD: Scoring distribution in the VK Cup finals: 500 — 1250 — 1500 — 2000 — 3000 — 3500

UPD2: Congratulations to the winners of the VK Cup 2021 Final Round!

UPD3: Division 1 round will be held on the VK Cup 2021 Finals problem set without any changes.

Scoring distribution for Div. 1: 500 — 1250 — 1500 — 2000 — 3000 — 3500

In Division 2 problems BDEF will match problems ABCD of Div. 1. Problems A and C of Div. 2 will be similar to problems F and E of Div. 1 (albeit being much easier). Besides that, problem D of Div. 2 will have a subtask with lower constraints than the original problem.

Scoring distribution for Div. 2: 500 — 1250 — 1250 — (1500 + 1000) — 2500 — 3500

As a reminder, the standings of the VK Cup Finals are available via this link — feel free to try gaining an advantage using all the information available before the round :)

UPD4: Editorial is available.

• +790

 » 4 weeks ago, # |   -18 another great round is coming :)
•  » » 3 weeks ago, # ^ |   -44 It's tourist Round.
•  » » » 3 weeks ago, # ^ |   +5 is this a problem?
•  » » 3 weeks ago, # ^ |   +2 Why are you getting downvoted?
•  » » » 3 weeks ago, # ^ |   +1 codeforces.
•  » » » » 3 weeks ago, # ^ |   +5 Many people have the mindset of "me see rating below 1900, me go downvote"
•  » » » » » 3 weeks ago, # ^ |   -6 It would be nice to add the ability to see who exactly downvoted or upvoted you. This will keep those people off.
•  » » » » » » 3 weeks ago, # ^ |   +13 or it just would be more of a reason to downvote
•  » » » » » » » 3 weeks ago, # ^ | ← Rev. 2 →   -7 At least it would make random downvoters fear the possible consequences if they are made known to the victim.
•  » » » » » » » » 3 weeks ago, # ^ |   +1 there are no possible consequences
•  » » » » » 3 weeks ago, # ^ |   -10 me see comment not from 1-gon, me go downvote
 » 4 weeks ago, # | ← Rev. 2 →   -25 Hope for a great round, good luck everyone.
•  » » 4 weeks ago, # ^ |   -34 Who don't know this.... ^
 » 4 weeks ago, # | ← Rev. 2 →   0 Amazing round!
 » 4 weeks ago, # |   0 Good luck
 » 4 weeks ago, # |   0 Going
 » 4 weeks ago, # |   -27 Hoping for a god contests
 » 4 weeks ago, # |   0 orz
 » 4 weeks ago, # |   -11 best whishes.
 » 4 weeks ago, # |   +41 What's Special
•  » » 4 weeks ago, # ^ |   0 cool
 » 4 weeks ago, # | ← Rev. 2 →   -31 Problem C of last two rounds made by tourist can be solved using binary search so what are the odds that this time also it's gonna be binary search. As he is on hattrick.. Binary_Tourist
•  » » 3 weeks ago, # ^ |   +1 you are right there.. hattrick done...
•  » » » 3 weeks ago, # ^ |   +8 Yes, but really i don't have an idea why CF community gave so many downvotes to my instinct..
•  » » » » 3 weeks ago, # ^ |   0 Me too.
 » 4 weeks ago, # | ← Rev. 2 →   -58 tourist rounds are always great! Very excited to participate this round!Sorry for disturbing tourist :(
•  » » 3 weeks ago, # ^ |   +3 how can this normal comment have negative vote?
•  » » » 3 weeks ago, # ^ |   +36 Don't ping tourist
 » 4 weeks ago, # |   -60 Everytime tourist writes a blog, his contribution reaches to the moon.
 » 4 weeks ago, # | ← Rev. 2 →   -61 i was planning not to enter this round but when i saw that tourist is the author im going to enter and i hope i do well and stop my decreasing rating streak.
 » 4 weeks ago, # |   +3 Making rounds based on some contest that has been held 2-3 days before, carries the risk of problem leakage. We do have seen such instances in the past when people submitted the first three problems in such minimal time which wasn't even enough to read them.If someone finds this wrong then feel free to comment. This is only my personal opinion and I think that fair competition is not possible in such cases because some people get an unfair advantage.
•  » » 4 weeks ago, # ^ |   +17 If I am saying something wrong then feel free to rectify it.
•  » » 4 weeks ago, # ^ |   +21 There is no obligation to participate.
•  » » 4 weeks ago, # ^ |   +79 This round was the Vk cup final. And all the contestants of this round were GM or above, also they're very well known in CF. It's highly unlikely that they would leak problems or cheat.
•  » » » 4 weeks ago, # ^ |   +1 Rounds that were based on many other contests have witnessed the same thing I am talking about. Not particularly with this round but there have been contests(based on some Random Olympiad) in the past in which the same thing happened as stated above.
•  » » 4 weeks ago, # ^ | ← Rev. 2 →   +5 First of all, most of the participants of the final round of this VK cup have written contests for CODEFORCES before. So I think they will respect other contests, if not then the same thing could happen to their contest(by testers or whatever else) and that, of course, is not what an author would want.What you mentioned is correct, but that round was not based on the final round of another contest, if I'm not wrong it was based on an elimination round.
•  » » 3 weeks ago, # ^ |   0 What you have seen are virtual participants, which are not rated(they joined the contests after it finished).
 » 4 weeks ago, # |   +4 Hopeforces...
 » 4 weeks ago, # |   -30 Hello again! = excitement again! :D
 » 4 weeks ago, # | ← Rev. 2 →   0 I see that viewing this list has revealed the level of problems in div1UPD : Friends, why does my comment get negative votes? This has been proven theoretically!
•  » » 4 weeks ago, # ^ |   +75 How do you propose to win using this information?
•  » » » 4 weeks ago, # ^ |   +80 First, you must analyze the level and skills of each participant in this list and find out the favorite and non-favorite topics of each of them.Then you put some questions and answer them: Why couldn't eatmore and receed solve the problem C? Although eatmore managed to solve both problems D and E. Why couldn't kefaa2 and Egor and KostasKostil solve the problem D? Although they managed to solve problem E. Why did Endagorion and Petr solve only 3 problems? Why was no all "Legendary Grandmaster" racer able to solve the last problem? Only never_giveup and Maksim1744 managed to solve it. There are a lot of questions too! After answering all these questions and looking at the old tourist Contests, you can guess the topics of the problems and prepare for them well and develop an appropriate plan for this Contest!good luck for everyone!
•  » » » » 4 weeks ago, # ^ |   +163 Wow, that's a lot of notifications.
•  » » » » 4 weeks ago, # ^ |   +9 (⊙.⊙(☉ₒ☉)⊙.⊙)
•  » » » » 4 weeks ago, # ^ |   +132 You spend way too much effort on this for it to be a joking post. See you in top 5 then.
•  » » » » 3 weeks ago, # ^ |   +157 It's simple: my cat walked on the keyboard and wrote a solution to problem E. I tried to persuade her to write D as well, but she was unshakable.P.S. Yes, as you can see from the score I have, solution was correct not on the first attempt. Even cats sometimes make mistakes.
•  » » » » » 3 weeks ago, # ^ |   +92 I need your cat tomorrow, don't worry about the food, it's on me.
•  » » » » » 3 weeks ago, # ^ | ← Rev. 2 →   +8 i need your cat as a personal coach for mine, as my cat skills can solve max C div2 and want to develop. edit: it will pay with tuna.
•  » » » 3 weeks ago, # ^ | ← Rev. 2 →   +16 Ormlis Congratulations for the Nutella, sounds like you managed to use the information :D
•  » » » » 3 weeks ago, # ^ |   +30 Thanks! Yes, I changed my strategy a bit for this contest =)
 » 4 weeks ago, # |   -27 2000+ upvotes easily
 » 4 weeks ago, # |   +60 My screencast (will become available after the round 740)
•  » » 3 weeks ago, # ^ |   +35 Download done!
•  » » » 3 weeks ago, # ^ |   +14 cheat case reported!
•  » » 3 weeks ago, # ^ |   +10 Thought that was gonna be a rick roll lmao
•  » » 3 weeks ago, # ^ |   0 about time
 » 4 weeks ago, # |   0 The score distribution is for both Div1 and Div2?
•  » » 4 weeks ago, # ^ |   +20 neither, it is for the offical contest.
 » 4 weeks ago, # |   0 Good luck to everyone ( ◜‿◝ )
 » 4 weeks ago, # |   +247 Has anyone noticed that the winner never_giveup was the last qualified person (Rank 32) of the elimination round! Congratulations for never giving up :)
•  » » 4 weeks ago, # ^ | ← Rev. 2 →   +67 I think its a lesson for us that we should never_giveup. :pCongrats never_giveup !!
•  » » » 4 weeks ago, # ^ |   0 I also never_giveup even after being stuck at specialist for around 8 months now .
•  » » » » 4 weeks ago, # ^ | ← Rev. 3 →   -65 Hey, I understand that you want to make a point, but don't you think tagging is unnecessary? I believe noone likes to be tagged just to see their handle being called just to see your struggle :p Edit : Why downvotes :( , It was just a sarcastic comment which is often used by Ari
•  » » » » » 4 weeks ago, # ^ | ← Rev. 2 →   0 Yeah,actually i thought to write something else before but then i wrote this and forgot to remove the tag
•  » » » » » 4 weeks ago, # ^ |   -35 bro this is codeforces here you can get downvoted for no reasons. You dont believe me checkout my blogs
•  » » » » » 3 weeks ago, # ^ | ← Rev. 2 →   -20 i think now it's a lesson for you and again never_giveup on commenting.So many downvotes ,still never gonna give up
•  » » » » » 3 weeks ago, # ^ | ← Rev. 2 →   +12 Says the one who tagged the same person twice in one comment?
•  » » » » » » 3 weeks ago, # ^ |   +1 Tagged you also
 » 4 weeks ago, # | ← Rev. 2 →   0 FINGERS CROSSED (̶◉͛‿◉̶)
 » 4 weeks ago, # |   +6 Good luck to everyone!
 » 4 weeks ago, # |   0 This round was the final of the Vk. And all the contestants on this round were GM or above, and they are also well known in CF.They are highly unlikely to cause leaking issues or cheating.
 » 4 weeks ago, # |   -88 I desperately want my contribution to be the lowest on this website,so please,do not give me any upvotes,I am begging you:)
•  » » 3 weeks ago, # ^ | ← Rev. 4 →   -16 Amen
•  » » » 3 weeks ago, # ^ | ← Rev. 2 →   -25 Yep, my wish is coming true, my contribution has been 4 point lower, big thanks to you guys:)And also, my first flag is to let my contribution be lower than yours @InTiMiDaToR
•  » » » » 3 weeks ago, # ^ | ← Rev. 2 →   0 Well if you want to go below me then cfiians might need to upvote me as well along with downvoting you right ?
•  » » » » » 3 weeks ago, # ^ |   -19 Ironically, I have never got a contribution higher than 0:)
 » 4 weeks ago, # |   -20 I just came back to pupil with a div3 of +147. Now, I'm afraid to be gray again. Anyway, Enjoying the contest is important. Good luck to everyone. I am waiting for a high-quality contest!
 » 3 weeks ago, # |   0 First place winner is never_giveup .. hmmm I feel this is a sign )':
•  » » 3 weeks ago, # ^ |   0 Rickroll):
 » 3 weeks ago, # |   +3 I'll never give up <3
 » 3 weeks ago, # |   +33 never_giveup's nick should have been 'never_gonna_give_you_up' to rickroll the standings!
 » 3 weeks ago, # |   +9 Since this round is prepared by tourist, you might as well check out some of his tips on competitive programming. link
 » 3 weeks ago, # | ← Rev. 4 →   -11
•  » » 3 weeks ago, # ^ |   +13 but why
 » 3 weeks ago, # |   +3 We love the earth :)
•  » » 3 weeks ago, # ^ |   0 Hi beluga :}
•  » » » 3 weeks ago, # ^ |   0 Hello hecker :)
•  » » » » 3 weeks ago, # ^ |   +11 Keep your mobile phone under the pillow...You will solve 5 problems today :}All the best
 » 3 weeks ago, # |   +3 LOL .. I thought the fanart image of the VK Cup was loading wrong in my screen :')
 » 3 weeks ago, # |   0 Just wonderful to see the author's name!! Yup, this is none other than the shining gem tourist. Good luck to everyone!
 » 3 weeks ago, # | ← Rev. 2 →   +1 Won't be able to solve any problem! Still participating :)
•  » » 3 weeks ago, # ^ |   -32 Me too :(
•  » » » 3 weeks ago, # ^ |   0 dude, you are a blue coder yet you are saying this?? You are soooo much better than me, man! I wish I knew half of what you know right now! I feel jealous :3
•  » » » » 3 weeks ago, # ^ |   -11 hehe, Blue is nothing to be proud of, good luck I hope you get to solve a few problems :)
•  » » » » » 3 weeks ago, # ^ |   +4 I am still learning.. Maybe one day, I will be able to solve at least a few problems.Best of luck to you!
 » 3 weeks ago, # |   +3 Good luck to everyone!
 » 3 weeks ago, # |   +14 i can be wrong but Problem A statement is some how confusing for me (:
 » 3 weeks ago, # |   -73 The problem statements are terrible!
 » 3 weeks ago, # |   -52 tourist be like: Teri kehh ke lunga
 » 3 weeks ago, # |   +12 I feel so dumb.
 » 3 weeks ago, # |   +31 How to solve Div1D?
•  » » 3 weeks ago, # ^ |   +5 Notice that the insertions put the following restriction on the final sorted array: for some positions $k$ and $k+1$ the values strictly differ $a_{k} < a_{k+1}$. For all other positions, the values might be equal. You have to count the number of such positions because if several insertions happen in the same place, they all contribute to a single restriction. To do so, you can track the current "strict" positions with a treap (it will allow you to increment positions for a suffix).Given the number of restrictions, let's look at the differences between subsequent elements. Add a 1 to the very beginning of the array and $n$ at the very end for simplicity. It's easy to see that for positions with restrictions the differences have to be at least 1, for other positions -- at least 0. In total, they should sum up to $n-1$, as the final element is now $n$ and the first is $1$. So, you have to divide $n-1-N_{restrictions}$ 1-point-differences between $n+1$ positions. By subtracting $N_{restrictions}$ we account for the "strict" positions. It is just a binomial coefficient.
•  » » » 3 weeks ago, # ^ |   +18 Damn, I think I got the second part, but I could not figure out how to find the strict positions. I guess I gotta learn treaps now.
•  » » » 3 weeks ago, # ^ |   0 Ohh, I got the part after the calculation of those special points, but I am surprised that it involved treaps.
•  » » » » 3 weeks ago, # ^ |   0 Can be solved with segment trees, but using a treap is more straightforward here (find X, insert X, add 1 on the range).
•  » » » » 3 weeks ago, # ^ |   0 If you go backwards, you can get away with a Fenwick tree. All you need is point updates (subtract 1), queries, and lower_bound.
 » 3 weeks ago, # |   +2 how do you solve B?
•  » » 3 weeks ago, # ^ | ← Rev. 4 →   0 Find the minimum number of breaks (let this be $x$). Now, every swap between A winning and B winning in will increase the number of breaks by 2 (because in the min. number of breaks, either all of A's wins are B's serves or all of B's wins are A's serves). So, we can reach everything in the sequence $x, x + 2, ... x + 2k$ breaks, where $k$ is the number of swaps we can make. You need to repeat this for both serving sequences ($ABABA$ or $BABAB$).
•  » » » 3 weeks ago, # ^ |   +1 There's an easier way around (IMO at least). Fix number of breaks A scores, for every $0 < i \leq a$. Now we can uniquely determine the number of breaks B possibly scored, because we know the total number of games A served, B served, A kept the serve, A lost the serve and B lost the serve. So just check for every combination if it's possible (total number of wins matches and no player won/lost negative number of times either by keeping their serve or breaking) and insert it into a set. Just print the output afterwards.
•  » » 3 weeks ago, # ^ | ← Rev. 3 →   0 Fix a K = total number of breaks._ Let K1 = number of breaks for Alice and K2 = number of breaks for Bob. Naturally, we have K1 + K2 = K. Now consider two cases: 1) The total number of games (a.k.a, a + b) is even: we know that the number of games where Alice serves the ball (call it HomeA) should be equal to the number of games where Bob serves the ball (call it HomeB) HomeA = HomeB a - k1 + k2 = b - k2 + k1 a - b = 2 x k1 - 2 x k2 k1 - k2 = (a - b) / 2 and you also have k1 + k2 = K, so you could solve these. If k1 or k2 is negative or greater than a and b respectively, then the fixed value of K is invalid. 2) When a + b is odd, you could do the same work but this time, HomeA + j = HomeB where j = {1, -1}That is how I solved it not sure if there is an easier way to be fair.
•  » » 3 weeks ago, # ^ |   +5 Consider a table  A serve B serve Total win A win aa ab a (given) B win ba bb b (given) Total serve count_a count_b if a+b is even: count_a = count_b = (a+b)/2 if a+b is odd: consider two cases count_a = (a+b+1)/2, count_b = (a+b-1)/2 count_a = (a+b-1)/2, count_b = (a+b+1)/2  You consider all possible values of aa which is between 0 to count_a inclusive. For each possible value of aa, you can fill out the rest of the matrix like how you fill up a Sudoku. The assignment is valid if all four entries are non-negative. For each valid assignment, add k = ab + ba to the result If a+b is odd, you consider the two possible set of values count_a and count_b could have.
 » 3 weeks ago, # |   +4 B is harder than D for me and I waste a lot of time on it :(
•  » » 3 weeks ago, # ^ |   +3 At least you solve B.
•  » » 3 weeks ago, # ^ |   +2 +1
 » 3 weeks ago, # |   -35 terrible question b.
 » 3 weeks ago, # |   0 how to solve C?
•  » » 3 weeks ago, # ^ |   +2 i did binary search
•  » » » 3 weeks ago, # ^ |   0 i also did but it wrong on pretest 2.
•  » » » 3 weeks ago, # ^ | ← Rev. 2 →   0 how do you sort the input array(caves)?
•  » » » » 3 weeks ago, # ^ | ← Rev. 2 →   0 They can be sorted by the max value of $a[i][j] - j$.UPD: Code int n; cin >> n; vector>> a(n); rep(i, n) { int k; cin >> k; a[i].first = 0; a[i].second = vector(k); rep(j, k) { cin >> a[i].second[j]; a[i].first = max(a[i].first, a[i].second[j] - j); } } sort(all(a)); int l = -1, r = 1e9 + 100; while(r > l + 1) { int m = (l + r) / 2; int strength = m; bool good = true; rep(i, n) { if(strength <= a[i].first) { good = false; } strength += len(a[i].second); } if(!good) l = m; else r = m; } cout << r << "\n"; 
•  » » » » » 3 weeks ago, # ^ |   0 tried this and also got wa on test 2
•  » » » » » » 3 weeks ago, # ^ |   0 same
•  » » » » » » 3 weeks ago, # ^ |   0 realized the mistake. Use Vector/array instead of map. There are some cases (subtest case 39 in test case 2) where map removes duplicates and it will lead to WA.
•  » » » » 3 weeks ago, # ^ |   -10 I created a structurestruct Cave{ int cnt ; int maxA ; };bool myCompare(Cave a, Cave b){ return a.maxA < b.maxA ; } void solve(int t){ int n; cin>>n ; Cave cave[n] ; FOR(i,0,n){ int m ; cin>>m ; cave[i].cnt = m ; int maxA = INT_MIN ; FOR(j,0,m){ int a; cin>>a ; if(a-j>maxA){ maxA = a-j ; } } cave[i].maxA = maxA ; } sort(cave, cave+n, myCompare) ; long long power = cave[0].maxA + 1 ; long long morePower = 0 ; FOR(i,0,n){ if(!(power>cave[i].maxA)){ long long diff = cave[i].maxA - power ; morePower += diff+1 ; power = cave[i].maxA + 1 ; } power += cave[i].cnt ; } cout<
•  » » 3 weeks ago, # ^ |   0 First of all, you have to find maximum one for every group. While finding maximum our heroes power should be at least:armor of monster — index of monster.after this, you should sort values of maximums and start from minimum one. if maximum in this group is bigger than answer increase answer
 » 3 weeks ago, # |   +14 C was easier than B for me
•  » » 3 weeks ago, # ^ |   +1 same.. the problem statement of B was quite confusing to me :(
 » 3 weeks ago, # |   +5 How to solve the bigger constraint for D? I feel blank :(
•  » » 3 weeks ago, # ^ | ← Rev. 2 →   +4 Mark multiples instead of checking factors. At a position $x$ for a given multiple $k$, we want to add $ans_{x}$ to all possible $y$ where $x = \lfloor \frac{y}{k} \rfloor$. This is just the range $[x \times k, (x + 1) \times k - 1]$. We can mark this range using a difference array by adding $ans_{x}$ to $diff_{x \times k}$ and subtracting it from $diff_{(x + 1) \times k}$. Now when we arrive at a pos $y$ we add $diff_{y - 1}$ to $diff_{y}$ to get the corresponding value added using multiples. Now we just add this to $ans_{y}$.Total complexity is $O(1)$ per multiple, so $O(n logn)$ total.
•  » » » 3 weeks ago, # ^ | ← Rev. 2 →   +5 I did the same thing but used a Fenwick Tree. Unfortunately, it TLEs. Maybe $O(nlognlogn)$ is not intended to pass.
•  » » » » 3 weeks ago, # ^ |   0 I suspect that is the case. Fenwick Trees are fast, but almost 2e8 operations on it feels like far too much. And anyway, it can be implemented using a simple array since we only update $y > x$ for a given x. Code#include #define int long long using pii=std::pair; using namespace std; const int maxn = 4e6 + 5; int n, m, ans[maxn], diff[maxn], prefans[maxn]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m; prefans[0] = 0; diff[1] = 1; diff[2] = -1; for(int i = 1; i <= n; i++) { diff[i] += diff[i - 1]; diff[i] %= m; ans[i] = (diff[i] + prefans[i - 1]); ans[i] %= m; prefans[i] = prefans[i - 1] + ans[i]; prefans[i] %= m; for(int mult = 2; i * mult <= n; mult++) { int from = i * mult; int to = (i + 1) * mult; diff[from] += ans[i]; diff[from] %= m; diff[to] += (m - ans[i]); diff[to] %= m; } } cout << ans[n] << "\n"; return 0; } 
•  » » » » 3 weeks ago, # ^ |   +1 I feel you :( I was convinced it's right approach just to see TLE test 7.
 » 3 weeks ago, # |   +50 I get that the constraints for Div1B were probably in an attempt to exclude $O(n^{3/2})$ solutions, but... seriously?
•  » » 3 weeks ago, # ^ |   +29 $n=4*10^6$ was too large for $O(n^{3/2})$. Soln I wrote gets tle for $4*10^5$.Regarding memory constraint, to me, it seems it was to stop precomputations of all factors of numbers using $O(nlogn)$ sieve.But still, it was imo a bad attempt since one can just compute all factors on the go using prime factorization. I ended up doing this.//spf[n] is one of prime factor of n. void getAllFactors(vi &fac,lli n){ fac={1}; while(n>1){ const lli p=spf[n]; vi cur={1}; while(n%p==0){ n/=p; cur.pb(cur.back()*p); } vi nf; for(auto x:fac) for(auto y:cur) nf.pb(x*y); nf.swap(fac); } } 
 » 3 weeks ago, # | ← Rev. 3 →   0 Total shot in the dark, but is Div1D somewhere along these lines? Consider an initial array $a_i = i$. Perform the $m$ specified swaps. Let there be $x$ positions, where $a_i > a_{i + 1}$, the answer is something like $2n - x - 1 \choose n - x - 1$.Ik its probs wrong, I have no proof for this at all, just intuition + guesswork, and no way to calculate this independently of $n$ (something related to at most $2m$ possible segments to check maybe?)
•  » » 3 weeks ago, # ^ |   +13 Yes, that's what I did.To calculate x, you can go backwards through the swaps, keeping track of the remaining indices with a BIT.
•  » » » 3 weeks ago, # ^ |   +8 Oof, I thought of using a BIT somehow but didn't think of going backwards, though it seems obviously easier now that you mentioned it. Thanks!
 » 3 weeks ago, # |   +1 I don't know if it's me but the problems seemed pretty difficult compared to other Div 2s. Seems I have a lot to work on.
•  » » 3 weeks ago, # ^ |   0 B was a slightly more difficult than normal, but D was miles easier than usual. You get something — you lose something. :P
 » 3 weeks ago, # |   -103 Can anybody plz mention any edge case for C for which my program is giving WA?My Program: #include using namespace std; #define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define fori(from, to) for(i=from; i> T; while(T--) { ll caves, i, j; cin>>caves; vector> vres; fori(0, caves) { ll monsters; cin>>monsters; vector vmon(monsters); forj(0, monsters) cin>>vmon[j]; ll maxval=INT_MIN; forj(0, monsters) maxval=max(maxval, vmon[j]-(j+1-2)); //finding the starting strength for every cave vres.push_back(make_pair(maxval, monsters)); //maintaining a vector of pairs : starting stength for a cave || no.of monsters in that cave } sort(vres.begin(), vres.end()); fori(0, caves) { ll temp=vres[i].first+vres[i].second; bool flag=true; forj(0, caves) { if(i==j) continue; if(temp
•  » » 3 weeks ago, # ^ | ← Rev. 2 →   +3 the distance between the max value and the entrance of the cave matters, you can't just sort by max valueadd spoilers to your code as well
•  » » » 3 weeks ago, # ^ |   0 Yes, based on that only I had calculated the initial strength at the starting of every cave. Can u plz pin point the line/section, where it is wrong, and how to correct that, or provide any test cases?
 » 3 weeks ago, # |   0 how to solve problem A ?
•  » » 3 weeks ago, # ^ |   0 Brute force works
•  » » 3 weeks ago, # ^ |   +3 Just implement it. (max number of iterations <= n * 2)
 » 3 weeks ago, # |   +7 Div2 B was a nightmare for me.
•  » » 3 weeks ago, # ^ |   +36 I will never play tennis for sure after this
•  » » » 3 weeks ago, # ^ |   0 This comment made my day XD
 » 3 weeks ago, # |   +9 its perfect time for cf to evolve since a lot of people are now solving c, this round was awesome
•  » » 3 weeks ago, # ^ |   +5 C was easier than B
•  » » » 3 weeks ago, # ^ |   0 Yess, for today but on an avg many people are doing a,b,c , maybe due to covid and being at home
 » 3 weeks ago, # |   +41 I accidentally submitted Div1B two times: 126856468, 126857306. The first submission was from the main site, but the page did not respond for quite a long time and I thought that CF is down. The second one was from m1.codeforces.com. The code is completely identical, so is it possible to return back -50 points for the "ignored" submission as it shouldn't have happened if not for some lags? CC MikeMirzayanov
•  » » 3 weeks ago, # ^ |   +45 I see a few submissions like that, they will be fixed after system testing is done.
•  » » » 3 weeks ago, # ^ |   +19 Thanks!
 » 3 weeks ago, # |   +1 Is there a stream to explain the solution to the problems?I'm waiting for it.
•  » » 3 weeks ago, # ^ | ← Rev. 2 →   0 video solution for Div2 C, I'll upload my solution for Div2 D as well soon.Update — Video solution for Div2 D
 » 3 weeks ago, # |   +28 Really great problems! I liked div 1 C and D (even though I wasn't able to solve D during the contest).
 » 3 weeks ago, # | ← Rev. 2 →   +13 So were there no hacks today? And that's so good about today.
•  » » 3 weeks ago, # ^ |   +5 pretests were strong i guess
 » 3 weeks ago, # |   0 C was way easier than B... I feel so dumb. This was my best chance to become specialist for the first time and I lost it.. T_T
 » 3 weeks ago, # |   0 Wow, it seems like 4 out of the top 5 of div 2 are alt accounts :v
 » 3 weeks ago, # |   0 I was getting MLE on test 7 in Div2 D2, I wonder if I should have have locked my D1 and looked into the submissions of D1 which were failing on D2 due to TLE but not MLE, I might have solved D2 then lol, but time remaining was very less.
•  » » 3 weeks ago, # ^ |   0 You can't lock simplified version until u solved not simplified, can you?
•  » » » 3 weeks ago, # ^ |   0 Ohh, I am sorry, I think you are correct, we can't do that.
 » 3 weeks ago, # |   +10 Any ideas on how to solve Div1 E?
 » 3 weeks ago, # |   +32 Ratings updated preliminarily. We will remove cheaters and update the ratings again soon!
•  » » 3 weeks ago, # ^ | ← Rev. 2 →   0 Hey,it so happened that my solution to problem C matches quite a lot with the one by another user. However, the code I submitted and the solution idea were completely mine and I hadn't taken help of even any online source (let alone copying someone's solution.) Also, regarding the ide part,I use codechef ide to code my solutions and those can only be viewed by signing in to my codechef account,so there was no leakage of code from my side atleast. Also,my solution was pretty basic and short ,so there is a high chance that it matches with someone else's code. The message I received said that if I have a conclusive evidence that the coincidence could have occured due to using some code published online before the contest,I can post those details as a comment to this post...but since, I hadn't used any online source to write my code, I have no idea how to prove my honesty except for the fact that the solution was too basic. I can also completely explain my solution if required. Also,due to this my rating was rolled back and this hurts even more since this was my best contest till now and I had crossed 1800 for the first time but now,I feel that I have been deprived of those rating points despite no fault of mine. So, I humbly request you to consider my participation in this contest valid and grant me the delta I deserved.
•  » » 3 weeks ago, # ^ |   +90 It seems that you've removed some of the cheaters.But why haven't the ratings updated again yet?
•  » » » 3 weeks ago, # ^ |   +45 the same
 » 3 weeks ago, # |   +7 +1 upvote for this wonderful round !
 » 3 weeks ago, # |   0 Can anyone explain how to do D1? I am not able to understand
•  » » 3 weeks ago, # ^ |   +12
 » 3 weeks ago, # | ← Rev. 2 →   -6 solved my first problem
 » 3 weeks ago, # |   0 Can div2 D be solved using segment trees? if yes. please can anyone help me with the approach!
•  » » 3 weeks ago, # ^ |   0 Yes, I upsolved Div2 D1 problem using lazy segment tree implementation from the atcoder library: Spoiler#include #include using namespace std; using namespace atcoder; int n, m; // Lazy segment tree, which supports "sum of elements modulo m" queries // and "add constant to a range of elements" updates. struct S { int sum; int n; }; // 'sum' of 'n' elements struct F { int c; }; // f(x) = x + c S op(S x, S y) { return S{(x.sum + y.sum) % m, x.n + y.n}; }; S e() { return S{0, 0}; }; S mapping(F f, S s) { return S{(int)(((long long)f.c * s.n + s.sum) % m), s.n}; }; F composition(F f, F g) { return F{(g.c + f.c) % m}; }; F id() { return F{0}; }; int main() { cin >> n >> m; vector arr(n + 1, S{0, 1}); lazy_segtree seg(arr); seg.set(1, S{1, 1}); // arr[1] = 1 for (int x = 1; x <= n; x++) { int ans = (seg.prod(1, x).sum + seg.get(x).sum) % m; seg.set(x, S{ans, 1}); // arr[x] = ans for (int z = 2; x * z <= n; z++) seg.apply(x * z, min((x + 1) * z, n + 1), F{ans}); } cout << seg.get(n).sum << endl; // arr[n] } The lazysegtree header file can be copy/pasted into the source code. It's fast enough for D1 126922899, but fails with TLE on D2 126922883. I need to check the editorial to see if anything can be improved or it's a dead end.
•  » » » 3 weeks ago, # ^ |   0 thank you so much!
 » 3 weeks ago, # | ← Rev. 3 →   +1 Can anyone help me with a weird issue that I faced after the div2C main tests.This was my submission which passed the pretests during contest : 126871707. However, It got runtime error on test 13 which I was not able to figure out why.I randomly removed the custom comparator function used in sorting and it got accepted : 126911540. Can anyone help me understand what went wrong in that comparator function? According to given input data, every vector should have at least one element.
•  » » 3 weeks ago, # ^ |   +3 Never use the "=" sign in comparator functions Reason
 » 3 weeks ago, # |   +8 Last tourist round, I lost pupil, this time I gained it back :D
 » 3 weeks ago, # |   +3
 » 3 weeks ago, # | ← Rev. 3 →   0 is this round unrated for div1 participants? because ratings hasn't rolled back yet!
 » 3 weeks ago, # |   0 Here to report 2 cheaters
 » 3 weeks ago, # |   -8 Hello , I am pretty sure that there is a mistake in engine check , please check those 2 solutions for problem C — Deep Down Below: this is my last submission in the contest : http://codeforces.com/contest/1561/submission/126904661and this is the exact code except that i removed the compare function passed to sort , which actually does exactly the same as sort except when pair.first == pair.second , i choose the cave with more monsters , and this should not affect the solution : http://codeforces.com/contest/1561/submission/126961415
•  » » 3 weeks ago, # ^ |   0 Actually it can influence.
•  » » 3 weeks ago, # ^ | ← Rev. 2 →   +8 A C++ comparator should return false when elements are equal, otherwise you can get a number of different verdicts (RE, TLE, WA and sometimes even MLE). (should be a.second > b.second, not a.second >= b.second)
 » 3 weeks ago, # | ← Rev. 3 →   +8 MikeMirzayanov Today,I got a message from system whose first few words were- "Your solution 126867937 for the problem 1561C significantly coincides with solutions ultizet/126864317, dumb_boi/126867937." I would like to clarify that I use codechef ide to code my solutions and that code can only be viewed by signing in to my codechef account. Also,my code was pretty basic and I hadn't taken help of any online resource to come up with the solution idea or code or anything. The message said that I must post my clarifications as a comment to this post. Also,since the code was solely mine,I don't have any evidence of any online resource which i 'might have' used(simply because i didn't use any) ,so I don't know how to prove my honesty except for the fact that the problem was pretty basic and there as a high chance that 2 solutions match coincidentally. Also,my ratings were rolled back. This hurts as this contest was my best contest till now and I had crossed 1800 for the first time :( . Now, it hurts knowing that I might not get those rating points despite no fault of mine.
•  » » 3 weeks ago, # ^ |   0 I haven't recieved any reply from codeforces yet...maybe i didn't post my clarification where I was supposed to...can someone help? Do I have to post it as a seperate blog post or something?
 » 3 weeks ago, # |   +199 When will the points for div 1 be restored?
 » 3 weeks ago, # |   +28 Is it unrated? /fn/fn
 » 3 weeks ago, # | ← Rev. 2 →   +8 Yay the points for Div 1 are rebalanced and back!
 » 3 weeks ago, # |   0 After I entered this div,I become purple.But for the roll back,the next div2 I get unrated? Can it be solved?
 » 3 weeks ago, # |   0 In the first problem of div 2 category. editorial code gives output 5 but its real ans is 4.  5 4 5 2 3 1 ` can anyone tell me why its output is 5?
 » 2 weeks ago, # | ← Rev. 2 →   0 tourist Why only 3 problems (A, C and D1) from the contest are put in practice section? When will remaining problems be posted? I mean in problemset section.
•  » » 2 weeks ago, # ^ |   +32 All the problems are available in the problemset section, the problems from Div. 1 are just a bit further down the list.