Hello, Codeforces community!

I'm glad to invite you to Codeforces Round #758 (Div.1 + Div. 2), which will be held on Dec/11/2021 13:05 (Moscow time). The round will be rated for both divisions. Note the **unusual start time**.

The problems were taken (mostly) from the ByteDance — Moscow Workshops Online Contest, which is happening at the same time. Tasks from the Online Contest are prepared by TadijaSebez and oversolver, additional tasks brought to you by Um_nik and gen. We are very thankful to the testers: Monogon, 74TrAkToR, AmShZ, DeadlyCritic, errorgorn, oolimry and icypiggy for their time and great feedback. Also big thanks to authors of other problems of the Online Contest snarknews and teraqqq for cooperation, Bytedance instructors jqdai0815, Syloviaely, Gromah, Claris for testing and reviewing the Bytedance online contest, the contest coordinator antontrygubO_o for the great help in setting up that round and MikeMirzayanov for testlib.h, Polygon and Codeforces.

ByteDance is a global technology company operating a range of platforms that allow people across languages, cultures, and geographies to create, discover and connect. ByteDance has partnered with Moscow Workshops and Codeforces to organize a top-tier and exclusive training camp for the International Collegiate Programming Contest. The upcoming Programming Camp will be held in Beijing from February 17th to 23th, 2022.

ByteDance — Moscow Workshops Online Contest is an opportunity to participate as teams onsite in this camp. Due to COVID-19 restrictions, mainly teams from China can participate onsite this year. For the international teams, the opportunity of online participation is considered.

You can find more information about this training camp at https://programcamp.bytedance.com/.

**UPD:** The scoring distribution is **250 — 750 — 1000 — 1500 — 2000 — 2500 — 2750.**

**UPD 2:** Editorial

3 contests in a day! CF, atcoder ABC, then CC starters.

There is also an Innopolis Open Olympiad, and Moscow Workshops Online Contest(which is what this round will be based on). So 5 contests in total, what a wild Saturday.

UPD: and Advent of Code! That's fascinating.

And me being in the bus during all of rated contests for me on that day

I hope there is a wifi connection in the bus :)

Coding from phone is definitely the best idea :)

No

https://codeforces.com/blog/entry/65377

I loved the problems.

Note The Unusual Timings:')Not Mentioned in the blog

UPD: Now changed, thanks KAN

Unusual Timings are becoming usual these days :|

Will it be based on ICPC style scoring or problems will have separate points like in normal div 1+2 rounds?

I think div.1 + div.2 always be a big challenge and it means large rating increasing or decresing. Hope everyone can gain more rating!

After 10 days of break, finally a codeforces round. Hope this round will be good.

Wait until you get to Div. 1 if you think 10 days is long.

For div 1 coder, like you, the word should be "long long long long".

I believe the technical term is

`__int128`

:)No no no it is

`__int256`

. You've counted wrong,`long long long`

is`__int128`

.Nothing prevents you from doing unrated participation in Div.2 rounds. That is if you want to have fun solving problems together with the others and then discuss interesting solutions after the contest is over. Also in an unrated round you are free to start solving problems in reverse order if wasting time on Div.2 A/B/C/D is not enjoyable.

I participated in an unrated Div.3 contest on Codeforces when I briefly became expert. And I participated in a few unrated Div.3 / Div.2+3 CodeChef contests too. Not to mention AtCoder AGC contests (unrated for a different reason). All of these contests were fun and challenging, even though they didn't affect my rating. So what exactly would I not get?

Rating is the motivation and that's the fact.

Participating in the first unrated contest (because one is an outside the rated range) is wholly different from consistently doing it.

Judging from your comments (related to different languages and compilers) that may not be the case with you. But it's the case with the majority of people here.

Then the original commenter still shouldn't complain because nothing prevents them from doing HackerEarth contests and geography homework.

I have nothing to say about your "geography homework" claim, because it's a total nonsense. I'm putting the rest of my reply under a spoiler, because it's a bit too long:

SpoilerBased on your comments, you are basically looking down on Div.2 contests and don't consider them worthy your attention. But if we check any Div.2 contest scoreboard, then it's possible to notice that a lot of grandmasters participate unofficially. And not all of them successfully manage to solve all problems, so there probably might be some challenge after all? You may think that these problems are way too easy for you, but I have reasons to suspect that you actually wouldn't be able to effortlessly solve all of them in all cases.

Then you are participating in a combined division contest, one of those easy problems bites you in your behind and your conclusion is that ... the format of Div.1+2 contests is just wrong. Of course this has to be it! Because it can't possibly be your own fault, right?

As an unbiased third-party observer (your success or failure has a negligible impact on my own rating), I think that maybe you are just not in your best shape right now. And neglecting unrated Div.2 contests partially contributed to that. Putting all blame on external factors is unlikely to help and can even can make the situation worse.

PS. The incoming massive downvotes on my comment are not an indicator of who is "right" or "wrong". This is just the usual ratism.

You are overthinking it.

That's it. That's the meaning of these two comments. Extracting anything else from there is a bit silly.

Here is my reply to your essayWhy must you extract more meaning from my comments than they contain? My comments are not a secret way of saying "I hate combined division because I recently lost rating on one". Just like I don't think that your comments are a secret way of saying "I love combined division because I recently gained a lot of rating on one", you should not think something similar about me.

The idea that I look down on Div. 2 contests is also just false. I don't know where you get that from but I guess you must be reading some of my comments and as you did now, add explanations or meanings to them that aren't there.

In general I don't understand why people so commonly seem to think they have it all figured out if they find just one connection. "Why is he complaining about combined division? Oh, he lost rating in a recent one, that must be it!" That explanation would certainly explain it, so it is probably true, right? $$$B, A \to B \vdash A$$$?

I have complained about combined division rounds many times in the past. Here is a short list. This compilation should at least show that it is not an opinion that forms after performing badly only. Rating change wise, I have never performed as badly as the last combined round, yet I have had the same opinion previously all the same.

The next idea someone might get is that I might dislike combined rounds because I usually get a rating drop there. But this is not the case. Here is an image of my recent combined division rounds. I removed the Div. 1 only rounds. We see some ups and some downs, in general there seems to be no reason to believe that I perform worse on combined division. So this also doesn't hold up.

I don't know what else to say, but I think it might just be plausible that I

simply don't like combined division roundsand there is no self-deceptive reason behind that? After all, I haven't claimed that they are somehow objectively bad; I haven't claimed that their "format is wrong". I think I have made it clear every time that my dislike of combined round is subjective and just a feeling, not a claim that they are objectively wrong.Why is the round combined division?

Personally, I hate combined division rounds with a passion. Even if they are very nice, I find that adding two easy problems to Div. 1 makes the round less enjoyable, at least for me. What is more, I find it horrifying that every scheduled, rated for Div. 1 contest until the end of the year is combined division. I can sort of understand why Global round is combined division, and I suppose that it is somehow traditional that the Good Bye round is combined division (especially if it is sponsored and therefore may have prizes) but what is the reason for this round? Just that it is a copy of some other contest?

Why though?

From what I understand (admittedly having never been in div 1), shouldn't combined rounds ideally be, for div 1 participants, a 30 mins or so speedtyping contest and after that a normal div 1 round?

Do you find a 30 min speedtyping contest fun?

Further, getting stuck on one of the easy problems is the worst feeling in the world and is a major tilting factor for me.

Yeah, understandable. Separate div 1 and div 2 rounds seem much better then for div 1 participants, since they take away the speed-typing part of it.

Agree, when I solved A,B and saw over 1000+ people have passed,the feeling is really bad :(

Good thing this contest was just a regular div1 with an extra easier problem :clown:

This is a tangent. If I face trouble solving a problem, I don't call it easy. Actually I try to refrain from labeling problems "easy" and observations "obvious". I don't like people doing that either, NGL. By calling something "easy" we undermine the observations which were required to solve it whether we meant it that way or not. Not at all saying its right or wrong, just felt this viewpoint should be out there.

Normally, I wouldn't worry too much about 30 mins of speedtyping, but the fact that this combined round is just 2 hours long makes me nervous, since it leaves only 1.5 hours for Div 1 problems. That is, if we do not fuck up and waste more time on the easy ones...

Combined rounds and easy problems are the reason why I'm at 2800 and not 2500 and I'm not very proud of this

A 2 hour combined round sounds really scary to me. Div 2 people tend to like combined rounds because they can gain a lot of ratings with a good performance. It sucks for us but we are the minority after all.

is it true div2 people can gain more rating in combined rounds? based on my experience the gains are exactly same as div2 rounds

If you over performs and beats some Div 1 participants you're not supposed to, you will gain more than you do in a normal Div 2 round (because you won't get a chance to beat them under this circumstance). This of course only applies to very few people each round but it does generate a mental effect for a lot of people.

There is a benefit to combined rounds, though. In many Div 1 only contests, if people don’t like the look of problem A they just bail out to stay unrated, which means that those who actually try are penalised for it. There was a very recent example of this in round 745 Div 1 — problem A was hard so over half the registered competitors submitted nothing. I think having a problem A and B doable very quickly kind of forces your hand — you’re either in or you’re out, you don’t have time to play the system.

This is not to say that you don’t make many valid points; just to point out one benefit which I actually consider quite significant.

Frankly I think that in every contest the problem A should be easy for all intended participants, partly because of what you said but also for other (mostly, psychological) reasons.

Imagine not upvoting this blog.

Nice

hi :D

Hi you

lol

So, my plan is to solve as many problems till 13:00 and then instead of despairing at the last 3-4 problems, I'll switch towards ABC contest to keep up that sense of achievement. #ICheatMyself

the best round because it's written by the best programmer

the reason newbies are bloody scared lol..

No testers are begging for contributions (specially 1-gon) XD.

Idk maybe ill just rant about testers commenting in blogs here since the round is over. Why is it normal that testers are commenting things such as "I loved problems", "Problems are beautiful". Why is everyone fine with people saying that? Would people be fine if I commented "I didn't enjoy the problems, they were boring"? Should we normalize testers saying "I hated the problems" in future contests now?

I honestly find it hard to believe that the guy who only solved ABC in VC and didnt upsolve anything else commented "I loved problems" because he genuinely loved the problems. You really looked at ABC and went "I love these problems"?

Can we as a community just stop pandering these types of testers, please. Make testing be a job of ensuring contest quality, not a contribution farmer for those with the right connections.

Thank you for listening to my TED talk.

There really is nothing wrong with testers saying "I loved problems", "Problems are beautiful" as a tester if you really enjoyed the contest. In fact, I think its a good way to encourage others to take part in a round that you believe they will enjoy, as well as a public compliment to the setters

But of course if you recommend the contest and people didn't like it otherwise, then you're at fault for misleading the participants who hoped for a good contest, and also making future "I loved problems" recommendations by testers less credible for actually good rounds. If they're an outlier who thinks it's good while others thinks it's bad then whatever, but outliers are rare (and should know when their opinions aren't aligned with what others think)

Anyways, if no tester comments anything, it probably says more about the round than if testers are commenting if they enjoy testing

if any of you are interested in cheating, send a message to nitin_05 or ashokesen02. they both became experts in codeforces by buying solutions and adding many comments in the codes.

Don't increase the interest. The situation already sucks as it is.

What may be the difficulty level for the problems?? If I could know, I could decide whether to participate or not as I only can solve up to 1200 difficulty level, anyone please have idea??

Beyond This i dont know Clearly coz i havent solve any :_:

I think even C will be about maths, not to mention any further problems

If you have this mentality, you will never improve

I have a gut feeling we are going to face problems of Byteland

contestfull day it is...

Give me some delta ...

Looks like I forgot to mention "positive". So much of negativity out here (:

Hope to gain some non-negative delta!

The difficulty gap between C and D

I guess they wanted people to switch to ABC 231 xD

The difficulty gap between C and B...

Before starting of the round : "I am gonna try to get to 1100 this time" After implementing problem B : "Ahh !! Shit, Here we go again"

Thank you very much for a disgusting round.

Me after rating changes.

Hmm this is weird my solution for C is n*Log(n) but it's TLE I can't see what did I do wrong

It was so difficult that I sat down in two minutes

I'm gonna have nightmares about B. Daaamn it took me so long to to get it.

how to solve it?

please I dont want to talk about this problem anymore.

But basically if abs(a — b) > 1 then you can't construct it.

also you can't construct it if a + b > n — 2

If

`a + b = n - 2`

, you actually can in some cases construct a valid solution.Example:

`n = 4, a = 1, b = 1`

Answer (one of):

`4 1 3 2`

Edit: the previous commenter changed >= to >

I meant > of course, changed previous message

You can take the starting value to be (a+b+1). Then, store the remaining values in a deque in increasing order. If you have to put a minima, take the least value from the deque and put it in the array. If you to put a maxima, take the greatest value from the deque and put it in the array. When you run out of the required maximas and minimas, you can put the remaining values in increasing order (if the previous value was a minima) or decreasing order (if the previous value was a maxima).

And, do not forget about the edge case when a = 0 and b = 0.

I hope this helps.

thank you for the worst contest i've ever seen , and f**k problem B

We should vote down this contest. B isn't the only reason why I felt awful. Otherwise there will be more contests like this contest.

My solution to E is nlogn*24, was it intended to fail? I have used ordered_sets which could have been avoided using fenwick but didn't have time to implement.

With $$$n = 10^5$$$, it should be very hard to fail on CF machines. My solution also uses those super slow multisets and runs in 1.2s on the worst of these 60 pretests.

Speaking of which, 60 pretests is excessive. This isn't some kind of wild random problem where no solution is guaranteed to be 100% AC.

I saw other submissions too and they have used ordered sets and seem identical to my approach, but why I failed T-T.

Actually, I submitted > 30 times, spent > 5 hours to optimize it, couldn't...

Then what's the intended complexity?

It's the same, and is indeed way faster than mine.

138774185

As straightforward as it gets for time complexity, 2*2*2*3*2*2 times we sort and gradually insert/remove $$$N/3$$$ elements. Multiset gives 1400 ms, heap 700 ms.

Yeah, but still there are many reasonable ways to implement it which has way worse multiplier. Mine had > 500 I guess. However it could barely pass TL with the new constraints.

Why did problem C have 1sec time limit instead of 2?

What the fuck was problem B

cancer

Hint for B?:(

Spoiler...Answer is possible only if

`abs(a-b) <= 1 && a+b <= n-2`

SpoilerDo n,1,n-1,2,n-2,3,... or 1,n,2,n-1,3,n-2,... then sort the end when you have enough local maxima and minima. It's a pain to code it correctly though and make sure you handled all the edge cases.

we can use two pointer approach to avoid lenghi implementation

I constructed it using a deque. I thought about 2 pointers but I didn't want to have to deal with the case when n is odd and the left and right pointer meet at the same point.

Why only 2 hours???

What an unbalanced problemset!

worst contest I've ever competed in

Fst'd C because I didn't clear the adj2(graph) in each test.Pretests are very weak

In C's pretest the answer is always everyone wins or exactly 1 person wins.A code in my room only had these cases and it passed.

Were pretests generated completely randomly?I am not sure how the above linked code passed pretests

Why would that TLE in C I'm not looking at any number twice right ?

CodeWhen using sets you appear to use (correctly) set::lower_bound, but with maps you use std::lower_bound instead of std::map::lower_bound. If you fix this does it solve your problem?

i called them mp1,mp2 as a reference that they represent the two maps in problem C but they're vectors I should write the code clearly there're several stupid things but i didn't waste time during contest to make the code better but that's not the TLE reason though or can i use that sort on vectors ? Or you mean i should use maps I'm confused

lots of people getting wrong on test case 21 on problem C. :( me also

Ideas for problem D?

I think it might be Qpow+NTT, but 10^5 seems to be a bit big for that...

It's easy to see that the coloring is valid only when the number of 'BB' and 'WW' is the same,except for when there is only 'BW' and 'WB'. The first case can be calculated by using generating functions.(Hint: $$$[x^k](1+x)^n=\dbinom{n}{k}$$$ ) The second case is quite trivial, then the complexity is just $$$O(n)$$$ or $$$O(n\log n)$$$ if you calculate the reciprocal using quickpow.

Any hints for Problem D?

SpoilerHow many white cells should we have?

SpoilerWhat is the neccesary condition for 'valid' coloring? Of course it should have same number of "W" and "B". Anything else? You can get it with some observations, and prove it.

Here's another one, which might contain more important spoiler.

SpoilerNote that "BW WB" is one of invalid example. Also, "BW BW WB WB" or "BW BW WB" is invalid. But how about "BW BW" or some kinds of "BW BW.... BW"? Is there any invalid cases that have "BB" and "WW"(and of course, having exactly n "B"s and n "W"s)?

Sure there isn't any invalid case.

Ok That's it. I think you almost reached to the answer. Count all the cases and subtract the number of invalid cases.

Spoiler's spoiler: Don't prove it, just submit.

look at their submissions.

nexoxogoc ouhtek robot_bobot ybgbsydvh

How did you find them ?

.

What is the non-convolution solution for D?

Well, you are convuluting terms of $$$x^a (1+x)^b$$$. It clearly becomes a single binomial coefficient.

Can you elaborate? my idea is that the number of $$$WW$$$ should equal the number of $$$BB$$$, But I think your approach is different.

Yes that was my idea too.

We want the ogf where BB is $$$x^{-1}$$$ and WW $$$x^1$$$. So after convolution we find the coefficient of $$$x^0$$$.

Now we state the polynomials for each string (i will ignore BW and WB for obvious reasons).

We want to multiply all these terms but actually it they are all of the form $$$x^a (1+x)^b$$$.

Now, we want to find $$$[x^0] x^a (1+x)^b$$$. But this just $$$\binom{b}{-a}$$$

Aww I didn't realize (1+2x+x^2)=(1+x)^2 and was thinking to use NTT... How stupid!

Thanks for the explanation!

Why can't we use NTT

We can just convolute everything in $$$O(N \log^2 N)$$$ using NTT and it passes in half the TL (which I submitted during testing because $$$N=10^5$$$ lol). 138776423

Alternatively, we can do it in $$$O(N \log N)$$$. We convert all $$$5$$$ polynomials to their point coordinate form using NTT then do the multiplication there and do the inverse NTT. 138777576

There is an alternate way to do it in $$$O(N \log N)$$$ by taking the logarithms of the polynomial.

Yes we definitely can, and that's what I attempted during the contest.

I'm just feeling idiotic for not realizing the trivial simplification.

lol, that was my initial idea which I brushed off? good to know how idiotic I was.

Lovely, thanks for explaining it.

The necessary and sufficient condition is #[WW] = #[BB] (except for if there's none, you must have all WB or BW). If you naively assign B's and W's to ?'s so there's an equal count of each, this forces the above condition. The only invalid assignments we may have counted are sequences with only WB and BW's, and a nonzero amount of each. We can easily subtract this overcounted value.

how are you going to handle strings equal to $$$??$$$.

Replace $$$x$$$ by $$$x^2$$$, then it'll be $$$(1/x^2+2+x^2) = (1/x + x)^2$$$

Sorry if I wasn't clear- instead of $$$n$$$ pairs, we view it as $$$2n$$$ characters (and then adjust for the corner case).

Code: https://codeforces.com/contest/1608/submission/138771080

Also, you can see that the condition is equivalent to # of $$$A$$$ = # of $$$B$$$, so consider each character individually.

Even this code could pass the pretests of C:

So crazy. I cannot understand.

Main Test 21 on C killed a lot of us :(

In fact it's the first test that the answer isn't all '1' or only one '1'.

Didn't expect problems like B and E in an anton contest.

I can't believe it!

C is the worst problem I've ever seen.Weak sample,weak pretest and stupid problem

I think C is a good problem but with weak pretests

Why is there no obvious corner cases in D's pretests?

~700 system test fail on C. Nice pretests you got there.

C has a lot of failed system tests because of weak pretests.

This actually made me realize something. It is for sure an unpopular opinion, but I think weak pretests can be a good thing.

C is exactly the type of problem that a lot of people solve by guessing: there are a lot of feasible-looking greedy-strategies, people implement one of them without knowing whether it actually works, get AC and move on to the next problem.

Weak pretests disincentivize guessing and make contestants more careful. It puts more weight to mathematical thinking and less to just quickly implementing something that might be correct.

The bad thing is that people expect "pretests passed" to mean "accepted" and get frustrated when they fail the system test. But if weak pretests were more common, people wouldn't have such an expectation and would be more careful from the start.

If you value the 'proving' of solutions more, why not just increase the penalty?

That's also an option.

However in my ideal world that I made up just now, pretests should include edge cases but not necessarily counterexamples to typical guesses. In that case:

However the edge cases are different for different (wrong) solutions, which makes it difficult to decide which should get a small penalty.

Well I think in C many genuine solutions also failed.The pretests were so weak that the number of winning contestants was always 1 or n.I heard from a tester that the testcases were generated today

How does a genuine solution fail?

Tests being generated today would certainly explain something.

In my solution I cleared adjacency list of original graph but missed doing that for the reverse graph and it failed.By genuine I meant correct idea of solution.my solution was to add an edge from index of the (i+1)smallest number to the index of the ith smallest number in the both the arrays.The winning set is the 1st SCC.

Well my solution was correct but only because I by mistake took sorted indices instead of original indices, it FSTed.

WA

AC

Just think how weak were pretests, that it passed with even wrong indices marked as '1' & '0'

Even a trivial test case where sorted indices and original indices didn't match should be added in the pretests (or even sample).

I very much disagree. If pretests were made weaker in problems where people just guess, people would still guess and now get FST instead of WA on pretests, which makes the results of the contest way more random and less skill-based, and the contest less fun for everyone.

I think the only way to fix this would be to require a proof of your solution in your submissions, which is obviously infeasible (but would be fun).

If you guess wrong, you should get FST instead of WA on pretests. I guessed and got lucky to get WA on pretests, that shouldn't happen.

Pretests is too weak, i sorted the array and forgot to put the answers back to those correct indexes, and that solution still passed pretests. If pretests were made to avoid guessing, it still need to be stronger to keep the genuine solution/idea AC.

That's fair.

It would also make hacking a bigger part of contests. I don't know if that is a desirable outcome. On the one hand it might make contests more interesting. On the other hand it makes your performance more dependent on the other contestants assigned to the same room.

however when I see this problem I immediately use strongly connected components to solve the problem instead of guessing conclusions although it took me a lot of time :(

In problem D, how to calculate $$$\sum_{x = 0}^{t} \binom{a}{t-x}\cdot \binom{b}{x}\cdot 2^{b-x}$$$ for every $$$t$$$ from 1 to 1e5 ($$$a$$$ and $$$b$$$ are constants) in $$$O(n)$$$?.

I realised it only 1-2mins before the contest end that you do not need to do that, you just need to make sure that the number of W cells = number of B cells. Forcing number of BB = number of WW while not caring the number of WB and BW, it is actually the same as the constraint number of B cell = number of W cells. Of course, you have to deal with the case where there is no BB or WW.

Figuring that out too late and having my C fail systest means I will be back to candidate master :(

My bad, I flipped all the right colors thinking that it would make things easy and ended up missing this observation. Thank you.

You don't need to. The final answer is a single binomial coefficient if you ignore the edge case, which you can subtract out separately.

What the hell, just mistake cell for grid point in E :(

same...

Very weak pretests on D

I can understand your pain bro,You got two FST. :(

How to unregister after contest ends?

Codeforces round #745(Div.1)+Codeforces round #745(Div.2)=Codeforces round #758(Div.1+Div.2)

Problem A was too easy.

Problem B was too weird for B level.

Problem C and D had too much FSTs and I didn't like C a lot(personal opinion).

Did not enjoy the contest that much.

Weak pretests and there are cheaters from byte-camp. Nice problems but bad round.

How to solve B cleanly? I have a monstrous 100 line casework solution but I seriously doubt its the intended:

$$$abs(a - b) > 1$$$ or $$$a + b + 2 > n$$$ $$$\longrightarrow$$$ $$$-1$$$

$$$(a = 0, b = 0)$$$ $$$\longrightarrow$$$ $$$1, 2, ..., n$$$

$$$(a = 1, b = 0)$$$ $$$\longrightarrow$$$ $$$1, n, n - 1, ..., 2$$$

$$$(a = 0, b = 1)$$$ $$$\longrightarrow$$$ $$$n, 1, 2, ..., n - 1$$$

otherwise $$$\longrightarrow$$$ split into $$$(a + 1)$$$ low segments (elements from $$$[1, n / 2]$$$) and $$$(b + 1)$$$ high segments (elements from $$$[n - n / 2, n]$$$) which alternate (Starting segment type and which segment $$$\frac{n + 1}{2}$$$ goes to for odd $$$n$$$ depend on whether $$$a \gt b$$$ or not). Sort each segment internally to ensure only one endpoint is a local maxima / minima (careful about sorting order for endpoints)

codeFor E, is it possible that every single submission that passed pretests get rejudged to AC? I recall only seeing 61 pretests, and after system testing, there are only still 61 tests, so I don't believe any new tests were added. My submission received TLE after system testing, but I submitted the same code after contest, and it received AC. Also with this AC, I would become grandmaster for the first time, instead of going back to International Master.

You can ask MikeMirzayanov , I remember it happened in previous rounds and the submission were rejudged .

You can't and you shouldn't. That one time was a mistake.

looks like I got rejudged and hit grandmaster

Is there any approach for solving C using C++ policy based data structures (PBDS)?

If you mean for finding at least one element smaller/larger, which is what I tried, you can just use lower_bound on sets, but my code fails. I guess this greedy won't work, could someone show me a counterexample?

Share my solution to D:

SpoilerIf you flip a[i] ,the restriction is b[i]=a[i+1] .

let a[i],b[i] be a directed edge ,and the sequence is good iff there is a euler tour in the graph .

This can be solved in O(n) by enumerating the in-degree of point 'W' or 'B'.

Here is some feedback on the contest:

A: This is the easiest problem I remember having solved on codeforces. Ok problem.

B: Ok problem. Since it is a problem B and there are various cases to consider (as the infamous

`1 0 0`

), I would have liked to have samples covering all possible cases.C: Very nice problem. During the contest I did not prove the correctness of my solution.

D: Very nice problem. The first part of the solution (understanding which colorings are valid) is interesting and clean, the second part (i.e., how not to use FFT) is magical. Could have been better with higher constraints (and another modulo) to prevent FFT solutions from getting accepted.

E: Ok problem. Together with cip999 we proposed a problem very similar to this one for GR14 to antontrygubO_o, but he rejected it. Still, I messed up the implementation badly. I would have appreciated a higher time limit.

Thanks to the authors.

Why weak pretest of problem C is not mentioned?

Because I did not know about the weakness of pretests of problem C.

In B $$$n$$$ was at least $$$2$$$ and samples had $$$a = b$$$ and $$$a + 1 = b$$$ and some $$$-1$$$ case. There could've been more cases covered, but I thinks that's good enough

Actually there is no need of FFT in problem D.

let a be the number of

`?W`

and`W?`

, b be the number of`?B`

and`B?`

, c be the number of`??`

, and k be the number of`BB`

-`WW`

. Then use DP. Let $$$f_{i,j}$$$ to be the answer after the first i strings and the number of "WW"-"BB" is j. Consider the transition, we can use generating function to describe it.`?W`

or`W?`

means $$$f_{i+1,j+1}\gets f_{i,j}+f_{i,j-1}$$$ so we can multiply it with $$$(x+1)$$$. Other cases are similar, and finally we get $$$(x+1)^a\left(1+\dfrac{1}{x}\right)^b\left(x+2+\dfrac{1}{x}\right)^c$$$, the answer is the coef of the term $$$x^k$$$. It turns out to be $$$\dbinom{a+b+2c}{k+b+c}$$$. And then we need to exclude the cases when only`WB`

and`BW`

exist. It's easy to solve it. We just need to minus $$$2^c$$$ and check if all strings can be one of`WB`

or`BW`

.Total time complexity: $$$O(n)$$$.

Yes, I know. I think I wrote pretty clearly in my comment above that the problem is nice exactly because FFT is not necessary.

My mistake. I saw it as

`how to use FFT`

XDThe only reason why I solved D was because of upsolving 1450H1 - Multithreading (Easy Version). That is either a sign that I'm too stupid (very possible) or that the problem was in the wrong spot considering the contest is there also for div2.

Case

`1 0 0`

is so infamous, so coordinator had removed it from original problem.17 Pages of WA *-*SpoilerI've won, but at what cost? :(

The pretests for D were really bad. There were no pretests containing very obvious corner cases like all characters equal to '?'

Being really happy to make a successful hacking attempt on Problem C and then failed to pass system testsI don't know why this happened.. during the contest prob-C passed all the pretests,,but after the contest was over and after system testing it shows that wrong answer on testcase 23...What is this? why this happened??????????????????????

Good contest full of adhoc problem. But I was not in good state..

I like F, but it would be better if the TL was more generous (I'm assuming my solution has the expected complexity). If you were afraid of $$$O(KN^2\log N)$$$ solutions with FFT, you could have used modulo $$$10^9+7$$$ to slow down such solutions.

G is a zero-idea implementation task. I really don't like it.

Bro bro wai petest so stronk??

Please can somebody say what's wrong with my approach? 138778827

Good contest! Interesting problems!

Ratings updated preliminarily. We will remove cheaters and update the ratings again soon!

why won't you remove cheaters from previous rounds?

137247368 137234971 137232569

How to solve problem C greedily

Code[Deleted]

Do you even know how much time it requires to create a problem? I also get fsted on C but its my fault only, not thinking about edge cases is ofc my fault.

He haven't even submitted task C, lol. Then I'm not sure why he thinks that the contest is bad.

Don't you think very weak pretest is rubbish?

TadijaSebez , oversolver by convention all cf div. 1 + div. 2 round has "Div. 1 + Div. 2" in the name where there's a space between Div. and the number. In this contest name there's no space between Div. and 1 so can you add a space as it is breaking CFTracker's categories. Thanks!

love this contest

Why dose the answer of sample #5 of F be 11? I can only find 8 arrays: [1,0,0],[1,0,1],[1,0,2],[1,0,3],[2,0,0],[2,0,1],[3,0,0],[3,0,1]

[1, 1, 0], [1, 2, 0], [1, 3, 0].

Very thanks.

Hint for C.

Didn't understood C.