Hi, Codeforces!

I welcome everyone to participate in Codeforces Round 877 (Div. 2), which will start on Jun/04/2023 17:45 (Moscow time).

The round will be rated for participants of Division 2 with a rating lower than 2100. Division 1 participants can participate unofficially in the round.

You will be given 6 problems and 2 hours to solve them. One of the problems will be interactive, so please read this guide if you are not familiar with interactive problems.

The score distribution will be 500 — 1000 — 1250 — 1750 — 2250 — 3000.

All problems were created and prepared by me.

I would like to thank:

- ScarletS and KAN for coordinating the round
- Alexdat2000 for translating statements to Russian
- AggravatedCow, ak2006, akifpatel, Awesome3.14, BucketPotato, dbaumg, Dominater069, EnDeRBeaT, errorgorn, fishy15, jampm, m0nster.eXe, maomao90, Nahian9696, nyaruhodo, Olympia, phattd, prvocislo, PurpleCrayon, satyam343 for testing the round
- and of course, MikeMirzayanov, for the Codeforces and Polygon platforms

Good luck to all the participants!

Update: Editorial is available

Winners:

Unofficial winners:

As a tester, they will silence me, but I will give you an insight that shall give you an unfair advantage:

Problems are sorted in ascending level of difficulty.

thank goD!

As a participant, we already knew that

As a tester, I enjoyed the round and found some very nice problems there!

Nice score distribution.

As a tester, ScarletS orz.

no u

jdurie

As a tester,

A comment saying that the pset is awesome (although I forgot the problems)As a participant, I am glad that I will actually be able to participate at this time!

Me too

You claim to be Java yet you solve using C++. Curious

Maybe he just likes to drink coffee?

Thank you for an early score distribution!

InteractiveForces)As a tester, I particularly enjoyed this contest, and I hope that you all can participate!

I wish +points for all and meAs a tester, the problems were very original and used ideas that I have never seen before.

Why does the last part make me a little .... scared .....

As a non-tester please give me contribution to annoy the testers

SpeedForces vibes?

#876 before #875 ?

Will this round become #875 then?

Checker comment:wrong answer jdurie found an answer, but contestants didn't.wow，through the tester，we can know the test is really good. I am looking forward to it!

As a tester, happy Chinese internet maintenance day!

懂得都懂（

Remark: for those (non-Chinese and Chinese alike) who don't understand what Sparky_Master_WCH1226 is referring to, look at the date of the contest, June 4th. It's the 34th anniversary of the Tiananmen Square massacre.

waiting...

waiting for system test now:))))))

As a tester I hope all you sussy bakas will enjoy the contest >w<

[insert an additional funny comment regarding the contest, with rizz]

orz sir

jdurie Orz

z

Wrong contest :)

Good luck everyone!

PaPayaORZWill it be my "Promotion to CM" round?

I believe in you!

It is my "Return to CM" round.

almost

D looks solvable from the score distribution. Hope to solve it ;)

was it !!!!!!

didn't manage to solve it :(

never judge a contest by its score distribution.

Score distributions can be deceiving ...

- author, drexdelta

it was definitely solvable, I almost solved it as a specialist

Pupil tester , I will test

It's so sad that I can't participate in this contest because of my courses

will there any panelty for wrong submission in CF Round 877?

Standard Codeforces rules are applied. You can read them here (relevant section: judging).

TL;DR: An incorrect submission that passes test 1, i.e. the (first) example test, but fails on another pretest, deducts 50 points from the score you would get by solving the problem. This means that each wrong submission decreases your total score by 50 points, but these points are only removed if you solve the problem with the wrong submissions.

why round delayed 10 min?

Perhaps, again, there are a lot of people who want to participate in the contest

;_;

There's randomly some 503 from codeforces.

I need to sleep!

one refresh cost me 10 min delay

Why delay of 10 minutes?

why 10 mins delayed??? please dont cancel todays contest.

is that your known fear?

again server crash !

Postponed?

hopping it is not a queueforces round considering so many participants

I have opened several pages, in one it's showing the contest started , would you like to enter ? and all others 10 min delay

If u click the bottom of go to the contest page, it will tell u "the contest didnt start" xd

Once you do click on enter, you get a notification saying "Contest has not started", so basically wait 5 minutes more.

OMG! more than

30kparticipants in division-2.why 10 mins delayed??? please dont cancel todays contest.

You sent this comment with your other account 5 mins ago!

It isn't my account . I want to express the same opinion.

30k participants in a Div 2 contest ! Hoping server would not crash .

DOS attack on Codeforces? (Don't mind me, just having an OD of Cyber security lessons ;_;)

server seems very reactive now. Refreshes in nanoseconds

Why has today's contest got so many registrants?

Rip m3

swapforces iykyk

This contest felt very, umh, 'unnatural' or just me?

Welcome to codeforces

So obvious bait comment tho.

Yes, CF does have it's 'falls' here and there, but overall it's been doing a pretty good job.

just asking out of curiosity is it me only and others also noticing that A problem of past two contest are not that trivial which they used to be

Why so hard

nice round,nice me,and wanna an expert:)

As a participant , It is indeed unfortunate when you get the Pure constructive problems , some algo+constructive is way good , but pure constructive is unfair :/

I was also stuck on problem C for a very long time, but I wouldn't call it unfair. It's just, unpleasant.

The problems are good, I like them. But they are a bit difficult. I have been stuck in the code implementation of problem D for a long time.

can i know what is the expected time complexity of D...i tried with O(n^2 * q) but it gave tle in pretest-9

My algorithm is $$$O((n + q) \log n)$$$.

It can be observed that we have two possible outputs of Yes:

The original string is a sequence of parentheses.

The first continuous left parenthesis in the original string is before the first continuous right parenthesis, and the last continuous left parenthesis is before the last continuous right parenthesis.

The above situation can be maintained using set.

code

how is that possible??atleast u need to traverse the string once did u mean nqlogn

looks at the constraints for n and q and time limit, nqlogn also wont get accepted

Can anyone explain how to solve E?

I don't know how to solve E, but maybe this problem from AtCoder help you — it is the same problem, but $$$M \le 2 \cdot 10^6$$$.

Main ideaArray values are not important at all.

tbh, that problem has ATCODER written all over it lol

I am once again asking to stop making stupid speed forces contests like this.

could D be solved without lazy segtree??

Yes. We just need to store all occurrences of two consecutive equal characters and update these every query. This can be easily done with std::set. 208498566

had the same algorithm, knew i had to use segment tree, but i didn't know how to write it :(

yes, but what if a RBS cannot be formed before first occurence of '((' or last occurence of '))'. how are you finding that?

If the first

`))`

appears before the first`((`

, no solution exists.Similarly, if the last

`((`

appears after the last`))`

, no solution exists.Now, suppose that the first

`((`

appears before the first`))`

and the last`))`

appears after the last`((`

. If the first character is`(`

and the last character is`)`

(and $$$n$$$ is even), a solution always exists. I suppose you understand how we can make everything in between these a regular bracket sequence.Let's look at the beginning of the bracket sequence. It must be equal to

`()()...((...`

, i.e.`()`

repeated some (0 or more) number of times, and then comes the first`((`

. If you don't see why this must happen, you should try to come up with a counterexample.It should be obivous that this can be simply just be walked and it will result in a regular bracket sequence. Similarly, we can see that the sequence must end

`))...()()()`

, which can also just be walked.Got it, Im just stupid..

Thank you very much!!! Very good explanation!

Just simple segtree with "find first non-zero element"

Look at string. It is corrent, if and only if it looks like this:

$$$()()()()()()()((-bla-bla-bla-))()()()()()()()$$$.

We will work with pairs of elements. We can track those $$$()$$$ as $$$0$$$ in segtree and all others $$$(($$$, $$$))$$$ and $$$)($$$ as $$$1$$$. Now, to answer query, ask segtree for position of first $$$1$$$, and check, that this is $$$(($$$. Do following with reverse direction.

I ended up with this summation for E, but I don't know where to go from here.

same

I just got the idea, but you have to notice that the actual array isn't important at all. The expression you got is independent of it(you can also write a simple recurrence to see this independence). So you can assume that the array is made up of all 1s. So, now you have to count the number of m sized arrays which have <=n-1 number of 1s and subtract from the total.

Same. In the first n gaps created by ai's, you can put any value except the value of ai following the gap

Doing some substitution of variables to transform your expression into this gives the same summation as in the editorial.

hashtag ihateconstructiveproblems

ikr. C blows

if nothing FSTs i'll become M for the first time!!

btw can smb please tell how to solve E

y so hard :(

btw how 2 solve c :(

put all consecutive integers in a row. If number of column is not a prime then you are done, For the same column, each row differs by a non-prime.

If number of column is a prime, then it's the same problem with swapping a series of number from (1- n) such that non of the adjacent number differ by 1. It's a bullshit problem imo

i finally know it, thx a lot :)

We can IF case $$$(n = 4, m = 4)$$$. Else, either $$$n$$$ or $$$m$$$ is at least $$$5$$$. Suppose $$$n \ge 5$$$. Then we can fill table this way:

$$$1, 2, 3, ... m$$$

$$$2m + 1, 2m + 2, ...$$$

$$$4m + 1, 4m + 2, ...$$$

...

$$$m + 1, m + 2, ...$$$

$$$3m + 1, 3m + 2, ...$$$

...

All differences will be either 1 or $$$km$$$, where $$$k \ge 3$$$. Therefore, each difference is not a prime. If $$$m == 4$$$ we can swap $$$n$$$ and $$$m$$$

i know it, thx for your number matrix :)

There is no rulebook that decides score distribution of problems, but,,, IN MY OPINION, C IS DEFINITELY NOT 1250 , and D IS DEFINITELY NOT 1750 .

C could be 1250, if

`n * m is an EVEN number`

, otherwise, its difficult to find the solution when`n * m is odd`

.Honestly I knew how to solve D, but I couldn't solve C even after trying for 1 hour 30 minutes. Why so hard C, and still 1250 points !

same 2 me. on task d you can easily think out to step many times on first "((" and last "))", and use segment tree and set to solve it, but on task c you hardly think out to swap rows to avoid prime difference.

TBH E is much easier than B, C and D, giving $$$a_i$$$ is just a trap.

Is the intended solution for F:

First check the boundaries (row 1, row n, col 1, col n) If the bad belt is not there, make a snake pattern that goes from (1, 1)->(2, 1)->(3, 1)->...->(n, 1)->(n, 2)->(n-1, 2)->.... and so on covering the entire board.

If you get an infinite response to this query:

else: do the same kind of binary search, but with directions reversed.

If this is the intended solution, it has an

awfulimplementation and what's worse is that idea-wise its not so hard.Yes, The idea of the problem is too easy, but

badimplementation with binary search.How to solve C?

My idea was to set the first line as a permutation of {1, 1 + n, 1 + 2n, ..., 1+ (m-1)n}. Once you find a permutation where the differences is not prime, then add 1 to each number n times.

If m is odd, then the differences should alternate between n * (m-1)/2 and n * (m + 1)/2. If m is even, the differences should alternate between n * m/2 and n * (m/2 + 1).

My approach--> We can fill the matrix starting from 1,2,3... row wise. For ex-> for n=5 and m=5 it will be - 1 2 3 4 5 - 6 7 8 9 10 - 11 12 13 14 15 - 16 17 18 19 20 - 21 22 23 24 25

Now we see that difference between any two adjacent row elements is always 1 and difference between any two adjacent column elements is equal to m(i.e. number of columns). So we can just swap the rows or simply first we can write the even rows and then the odd rows.. doing any operation like this will make the difference between any two adjacent column elements, a multiple of m which will be non-prime.

there is an edge case for n=4 and m=prime in which we can just do the same thing with columns.

I am unable to write the matrix in a grid form, so please understand that after every hyphen '-' a new row starts.

This is my approach

If m is not prime just go from left to right, top to bottom and increase one on each step

Horizontal difference will be 1 Vertical difference will always be m

If n is not prime just do the same but increase one from top to bottom (rotate the matrix)

If both of them is prime it doesn't matter if we work on rows or columns, so we will choose working on rows

The first row will be 1 to m Starting with the second row we will apply this approach:

Find the largest element in the last row, let it be x Insert x+1 exactly below it (let it be mn) Add x+m (max number in this row, let it be mx) to the left of mn

It is clear that the difference between mn and mx is always even because mn = x+1 mx = x+m mx-mn = m-1 (m is prime >= 4) Go from this mx to the left of the row decreasing one in each step Then go from mn to the right of the array increasing one in each step

Now the row is finished with all numbers between mn and mx (inclusive)

Now we need to prove that the vertical differences will always be either 1 or an even number

If we ignore the first row Every number will have different parity than the two numbers on their sides, except the smallest one which will have the same parity as the number on its left side

mn have difference of 1 with its top element which was x

Each element on the left side of the mx of the last row have difference parity than its neighbours So when we set mx to the same parity of its top element and increase 1 on each step going to left, each element on its left side will have the same parity with its top element

The right side of mn will always have the same parity with its top element because the mn have difference parity than its top element, its right side increase by one and its parent go one step with the same parity and then increase by one

Note: we can get the next mn position if we go from right to left in a circular way (decreasing one on each step and when we are at position 0, we go to m again)

Man C sucks. It's one of these problems where you just have to mentally brute force different solutions until you luckily find one.

D is easier than C for me. Imagine training on 2100 problems for the last few days that require good intuition just to get bogged down by bullshit problem like Div2.C

How do such problems like C even get accepted?

as a tester, i found it brilliant, here is how i solved it :

1) 1 is obviously good, so having continuous subarrays is excellent

2) we only need to worry about the difference between the starts of the rows now

3) 2x is always non prime, so something like 1 * n 3 * n ..... 0 * n 2 * n ..... will work

and done, no logical jumps, nothing, just plain logic. Why do you dislike it?

I couldn't get the intuition how to solve it. I hate such problems where you basically have to guess the correct construction of the answer.

does it seem like i guessed the construction even in the slightest?

The way of placing numbers row by row seems a bit guessed for me.

You may argue that any solution to any problem is basically guessing the correct steps. Okay, that's fair. Still, this problem is pure construction of the answer, and you definitely need some intuition or experience how to do that. I couldn't think of anything for 20m, so I skipped it.

its a div4G, so i immediately recognized it (well not quite, but close enough) https://mirror.codeforces.com/problemset/problem/1352/G

the basic idea is just to go differences of 2, i think thats fairly doable

I haven't solved that particular problem, maybe if I had, it would be easier for me with this one.

There have been similar pure constructive problems in the past, and I managed to solve them pretty fast because I had solved similar problems before.

Ik this again sounds stupid, since basically any solution is partially based on the previous experience. Nevertheless, I have my right to not like such type of problems, especially this one after not solving it :)

absolutely, you do, i explained why i liked it :)

Wasted 40 mins with 4 wrong submissions on D because I missed the observation that the segment length had to be even ;_;

problem C: lol, understood 2 as non-prime and thought finally I have gained the ability to solve C in div2, but soon had an epiphany

When is system testing?

Nice D

Spoilerhardforces

Task C is easier than task B...

Share solution for C

I think B is easier than A.

A,B,C is so hard for me :(

Kept thinking about moving 1 and 2 as far as possible in B, but the idea was to bring n between them if possible.Took a lot of time to observe this :(

same couldnt submit it in time

yes after soo many trail and error observed this

Is this the correct logic for B: if 1 is on the first or last index swap 2 with the opposite end and vice-versa otherwise use the position of the n and swap such that n comes in between 1 and 2.

You just need to take n Between 1 and 2.

idea: 1. if 1 and 2 are adjacent to each other, find relative position of n and swap thee one that lies in the middle acc to their position (1,2 and n)

It's a great pity that I divided B into 8 situations and got +10...I was shocked when I tried hacking.

nice contest XD

How did so many people manage to solve C? Share your thought process and how you came up with the solution pls, it was so hard for me.

I noticed that we can just print 1 2 3 4 ... when m is even, for each row. I didn't manage to think that if m is non-prime we can still do the same.

I also noticed that we needed to make some integers have difference of 1 for the ones at the "border", so that odd — even will give exactly 1. But how to proceed further? I literally could not think of it

UPDATE: Thanks everyone, my thought process here: https://mirror.codeforces.com/blog/entry/116995#comment-1034794

Soory sorry I participate with alt account today

Just think about:

n+1 n+2 ...

3n+1 3n+2 ...

...

1 2 3 4 ...

2n+1 2n+2 ...

...

So C<<A for me...

5x5:

6 7 8 9 10

16 17 18 19 20

1 2 3 4 5

11 12 13 14 15

21 22 23 24 25

Ok got it, but how did you think of this solution? Just keep trying until something works? I could not spot this pattern at all during the contest.

Sorry, I used another similar plan to solve it. It has been corrected now.

So for 5x5 this is ok:

6 7 8 9 10

16 17 18 19 20

1 2 3 4 5

...

if P is prime, then P+1 is never prime

so you can do this:

(rotating the rows) as you can see, a[i][j] and a[i+1][j] differ by p+1 or 1

If u know how to build table if m is not prime, you will notice, why this way doesn't work if m is prime. Now let's think how to fix it... Let's try to do the same thing but difference between two rows should be k * m, where k > 1. Well... it's clear that using odd rows at first and even rows then solves this task.

ok thats true, i guess i tunneled too hard on m == even or odd,

I also didnt see that we can swap the rows directly, I tried other different patterns like +4 +4 +4 +4, zigzag, spiral, diagonals, and

1 2 3 4 []

5 6 7 8 []

...

and then I couldn't fit the last column.

my thought process was

First, if m is even, then we can just print the numbers in order. numbers in the same row will have difference 1, and numbers in adjacent rows will have an even difference (and nonprime since n,m >= 4)

My second thought was if m was odd, then we could reorder the rows such that it goes (row 1, row 3, row 5. . . row 2, row 4, row 6 . . . ), but this didn't always work when n was even. For example with n = 4, m = 7 row 2 would follow row 3 and have a difference of 7 between them

But I realized that when n is even, I could instead just mirror my approach for when m was even, going along the rows instead of the columns. Combining the 3 ideas, a complete solution is reached

Unpopular opinion: B no is a messy garbage problem..

Today I reach yellow if I don't fst

Congrats!

How to solve C?

Generate multiple for n%2==0 like 2 4 1 3 Else for n odd 1 3 5 2 4

Linearly assign numbers from 1 to n * m. If m is non — prime, that would be your answer. If m is prime, reorder rows such that the difference is multiple of m.

I solved just after the round was over... I hope this is right... my approach:

let's consider three cases.. 1) when n and m both are non-prime then the solution is simple, just print

(1 2 3 4 5..m),

m+1 m+2....

because the neighbors will be {1,m,1,m}

2) when n is prime and m is prime then let for 5 7,

v[0]=1 2 3 4 5 6 7,

v[2]= 15 16 17 18 19 20,

v[4]....,

v[1]....,

v[3]....,

i.e. first even ones,then odd ones or vice-versa because the neighbors will be {1,k*m,1,k*m}

3) when n is non prime but m is prime try for 4 5 instead of horizontally like case 1, try it vertically

(1 5 9 13 17),

(2 6 10 14 18),

(3 7 11 15 19),

(4 8 12 16 20),

because the neighbors will be {n,1,n,1}

case 1:when m is non prime answer is 1 2 3 4..m(row1) m+1.....2*m(row2) .........n*m(row n) case 2:when n is non prime answer coloumn nos 1 2 m 1 n+1 ....... 2 n+2........ 3 n+3........ . ......... . . n 2*n......n*m case 3:when n and m both are prime intialize the answer as 1 2 3 4.....m(row1) m+1 m+2 m+3........2*m*(row2) 2*m+1..............3*m(row3) ....................n*m(row n) print row 1:1 2 3 4....m then all even rows in descending order then all odd rows in descending order

D solution: Imagine the string as a continuous segment of open and close. Notice that if the segment size is more than 1, you can have whatever count you want for open/close, but you can not change the parity.

You can make a regular bracket in the end iff parity of open and close segments are the same + string start with open and end with close, in addition, before you encounter a segment of open that is larger > 1, the balance must be 0.

Pending system testing,still how much time it takes?

The content of this competition is very good, can very well expand my thinking and writing code ability

A: We can only create non-negative new numbers, so if there's any negative number, output it. Otherwise all numbers are non-negative, since for any a,b we have abs(a-b)<=max(a,b), the maximum number of the list will not increase during the process, so we can output the maximum value.

B: If the permutation is something like [..., 1, ..., n, ..., 2, ...] or [..., 2, ..., n, ..., 1, ...], there are only 2 subarrays which is permutation ([1] and the whole array), since any subarray containing 1 and 2 will also contain n. And by checking for cases with n=3 we can see that we always can swap 2 elements of 1, 2, n to reach this lower bound.

C: If m is even, we can arrange the matrix like:

1 2 3 ... m

m+1 m+2 m+3 ... 2*m

2*m+1 ... 3*m

...

where absolute differences are 1 and m (since m>=4 and m is even, m is not a prime).

We can transpose this construction to solve for n is even.

If both m and n are odd, we can construce the last column like: [m, (n+3)/2*m, 2*m, (n+5)/2*m, ..., n*m, (n+1)/2*m], since n>=5 absolute differences of them are mutiples of m and not less than 2*m, so they are not prime. Then we fill other columns by ans[i][j]=ans[i][j+1]-1.

D: First the length of a walk will have the same parity of n, so if n is odd all answers will be NO. Also the first char of the walk will be s[1] and the last char of the walk will be s[n], so we must have s[1]=='(' and s[n]==')'. Otherwise, we need to look at occurences of "((" and "))" in the string. If their are no such occurences the answer is YES. Otherwise, consider the first occurence of them: the prefix contain the first occurence will be something like "()()...()((..." or "()()...()*)*...". For the second situation there's no solution, because when the first time we walk to * ) * the prefix sum will be -1. So the first occurence of "((" must be before the first occurence of "))". Symmetrically, the last occurence of "((" also must be before the last occurence of "))". If both conditions are satisfied, the answer is "YES" because the string will be something like "()()...()*((*...*))*()...()()", and we can walk back and forth on * (( * and * )) * to make the sequence regular.

E: Consider the subsequence in b[i] which is same as a[i] and has the lexical minimum sequence of indexes (that means, we find the first occurence of a[1] in b[i], and find the first occurence of a[2] on the right of a[1], and so on). Then numbers before a[1] cannot be a[1], numbers between a[1] and a[2] cannot be a[2], ..., numbers between a[n-1] and a[n] cannot be a[n], and numbers after a[n] can be anything. So let t=the position of a[n] in b[i], the answer will be sum(t=n...m)(C(t-1,n-1)*(k-1)^(t-n)*k^(m-t)), since m<=1e9 we need some mathematical tricks to calculate it.

Important observation for D:

Problem becomes symmetric as well

Different method to solve would be to optimize this (messier than Yocycraft's solution, but easier to come up with i guess): 208507662

is there a simple way to do D?

What i did is split into three separate check:

Maybe problem D, E or F were interesting. Unfortunately, B and C were so shitty that I couldn't read the rest

Well, Question C screwed my mind for 1 hours straight

How to solve B , I did solved A & C , but overthinked B , my approach in B was to move 1 , 2 and max element in certain manner but could not proceed any further any help would be useful !

I read that the idea was to put n between 1 and 2. I was trying to get the 2 away from the 1 as much as possible, but I dont know why that Idea didnt work, at least for me.

Counter example:

trying to swap the number 2 with n-1 is going to result in 3 permutation subarrays.

Doesn't work because:

3 2 4 1 5

swap 2 to index 1, becomes: 2 3 4 1 5

Realise that 1 2 3 4 is a subarray permutation, but if we do: 3 2 4 5 1, we will not get 1 2 3 4.

Thank you! :)

Your idea is correct. We need the max element ($$$= n$$$) to be between $$$1$$$ and $$$2$$$.

Why?The single subarray $$$[1]$$$ is always going to be a permutation. And so is the full array. This means that there are always at least $$$2$$$ subarrays that are permutations. For a subarray to be a permutation of integers $$$1$$$ to $$$k$$$, it must contain all integers from $$$1$$$ to $$$k$$$ and no larger integers. If we place $$$n$$$ between $$$1$$$ and $$$2$$$, no subarray is a permutation of integers from $$$1$$$ to $$$k$$$ if $$$2 \le k \le n-1$$$. Why? This is because placing $$$n$$$ between $$$1$$$ and $$$2$$$ forces $$$n$$$ to be contained in any subarray containing $$$1$$$ and $$$2$$$. Such a permutation subarray would have to contain both $$$1$$$ and $$$2$$$. Thus, it would also contain $$$n$$$, contradicting the fact that it is a permutation.

We can do the following:

Thanks ! I got it now .

Moving n between 1 and 2, without moving any numbers if it is already there, ensures that the constructed order is only {1} and {1,2,... n}, the least case. orz

An easy way to do C is:

if M even, just fill numbers row by row;

if M odd, then use the snake structure:

1 2 3 4 5 6 7

9 10 11 12 13 14 8

17 18 19 20 21 15 16

.....

then difference between every pairs will be 1 or even number larger than 4.

Problem D was wonderful!

Was this round UNRATED?

expected rating of problem D?

CLIST predicts 2200 (approx.)

Thanks

Hey, I was wondering whether clist rating is more credible or cf rating. They do differ significantly for a lot of problems. Edit: When I talk about credibility, I don't need the absolute rating to be perfect. I only care about relative rating. What I mean is if problem x is objectively harder than problem y, it should have higher rating than problem y. This way I can filter a range of problems effectively for my practice.

Is cf rating a website or a browser extension? Can I get a link to it?

By cf rating I meant the rating of the problem on codeforces website.

Ohh, I'm stupid. I don't know which one is better, but I don't think that the difference is very significant.

Thanks a lot for the contest.

Congrats!

Thanks

Amazing contest I become pupil after it <3 <3.

Could anyone help me with this code at problem D? Your text to link here... I get wrong answer on 4th query of test 4 (no instead of yes), but when i run my code locally it works. Does anyone know what could be the cause ?

If your code works in one environment and doesn't work in another, the reason is almost always either

Compiling and running your code with the

`-D_GLIBCXX_DEBUG`

compilation flag shows that your code is your code is attempting to dereference a past-the-end iterator. This is undefined behavior. Your code is too long, I won't try to debug it. But hopefully you can find and fix your bug with this information.Thanks, I've modified it and now I got accepted.

I'm blue!)

Amazing Contest. Thanks to jdurie and all the testers! Also can anyone please tell the difficulty rating of A,B,C?

800 1100 1400 (by Clist)

SpoilerWhy unr？

Why?