Codeforces Round #758 (Div.1 + Div. 2)
source link: http://codeforces.com/blog/entry/97715
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
By TadijaSebez, 5 days ago,
Hello, Codeforces community!
I'm glad to invite you to Codeforces Round #758 (Div.1 + Div. 2), which will be held on Saturday, December 11, 2021 at 10:05UTC. 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 Bugman, additional tasks brought to you by Um_nik and gen. We are very thankful to the testers: 1-gon, 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 cat998__ for cooperation, Bytedance instructors Retired_MiFaFaOvO, 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
5 days ago, # |
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.
5 days ago, # |
I loved the problems.
Note The Unusual Timings
4 days ago, # |
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!
4 days ago, # |
After 10 days of break, finally a codeforces round. Hope this round will be good.
-
After 10 days of break, finally
Wait until you get to Div. 1 if you think 10 days is long.
-
The comment is hidden because of too negative feedback, click here to view it
-
-
The comment is hidden because of too negative feedback, click here to view it
-
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.
-
The comment is hidden because of too negative feedback, click here to view it
-
You are overthinking it.
- The meaning of my first comment: Div. 1 contests are more sparse than Div. 2 and it is kinda funny to see Div. 2 people complaining.
- The meaning of my second comment: A Div. 2 contest is not the same as a Div. 1 contest, just as a Div. 2 contest is not the same as a HackerEarth contest.
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 essay
-
-
-
4 days ago, # |
How many problems?
4 days ago, # |
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.
-
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.
-
-
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.
4 days ago, # |
is there any division 3 contest?
4 days ago, # |
Will the ratings for the problems be published beforehand ?
4 days ago, # |
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
4 days ago, # |
Finally!!
4 days ago, # |
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
-
4 days ago, # |
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.
4 days ago, # |
-
A - [800,900] (Greedy or some basic maths)
B - [1000,1200] (Implementation or Greedy)
C - [1300,1400] (Bs, prefix sum Greedy, two-pointers)
D - [1500- 1700] (some data strcture, dp, maths ,even greedy
Beyond This i dont know Clearly coz i havent solve any :_:
4 days ago, # |
I have a gut feeling we are going to face problems of Byteland
4 days ago, # |
contestfull day it is...
4 days ago, # |
expecting i will be specialist after today's rated contest
3 days ago, # |
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"
3 days ago, # |
Thank you very much for a disgusting round.
3 days ago, # |
Me after rating changes.
3 days ago, # |
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
3 days ago, # |
It was so difficult that I sat down in two minutes
3 days ago, # |
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
-
-
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
3 days ago, # |
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 , 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.
-
Actually, I submitted > 30 times, spent > 5 hours to optimize it, couldn't...
-
As straightforward as it gets for time complexity, 2*2*2*3*2*2 times we sort and gradually insert/remove elements. Multiset gives 1400 ms, heap 700 ms.
3 days ago, # |
Why did problem C have 1sec time limit instead of 2?
3 days ago, # |
Hint for B?:(
-
Spoiler
-
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.
-
we dont have to worry about that case check this if you want
-
-
-
-
Asides the condition that SouLPegasuS pointed out, the basic idea is that swapping any two numbers in the range (2,n — 1) increases a and b by one. Swapping the first and second increases b by 1. Swapping n and n — 1 increases a by one. Then you can build the array from there.
3 days ago, # |
Why only 2 hours???
3 days ago, # |
What an unbalanced problemset!
3 days ago, # |
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
3 days ago, # |
Why would that TLE in C I'm not looking at any number twice right ?
-
When 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
-
3 days ago, # |
lots of people getting wrong on test case 21 on problem C. :( me also
3 days ago, # |
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: ) The second case is quite trivial, then the complexity is just or if you calculate the reciprocal using quickpow.
-
How did you find them ?
-
they were mentioned as cheaters in the previous round.
but they were never caught even with the same codes.
-
3 days ago, # |
Why problem C has extremely many people fst?(including me)
3 days ago, # |
What is the non-convolution solution for D?
-
Well, you are convuluting terms of . It clearly becomes a single binomial coefficient.
-
Can you elaborate? my idea is that the number of should equal the number of , But I think your approach is different.
-
Yes that was my idea too.
We want the ogf where BB is and WW . So after convolution we find the coefficient of .
Now we state the polynomials for each string (i will ignore BW and WB for obvious reasons).
- ?B/B?:
- ?W/W?:
We want to multiply all these terms but actually it they are all of the form .
Now, we want to find . But this just
-
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 using NTT and it passes in half the TL (which I submitted during testing because lol). 138776423
Alternatively, we can do it in . We convert all 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 by taking the logarithms of the polynomial.
-
-
-
-
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 .
-
Sorry if I wasn't clear- instead of pairs, we view it as characters (and then adjust for the corner case).
Code: https://codeforces.com/contest/1608/submission/138771080
-
3 days ago, # |
Didn't expect problems like B and E in an anton contest.
3 days ago, # |
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
3 days ago, # |
Why is there no obvious corner cases in D's pretests?
3 days ago, # |
~700 system test fail on C. Nice pretests you got there.
3 days ago, # |
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:
- not noticing edge cases gets a small penalty;
- guessing and submitting an unproven idea gets a big 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).
-
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.
3 days ago, # |
In problem D, how to calculate for every from 1 to 1e5 ( and are constants) in ?.
-
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 :(
3 days ago, # |
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.
3 days ago, # |
Weak pretests and there are cheaters from byte-camp. Nice problems but bad round.
3 days ago, # |
How to solve B cleanly? I have a monstrous 100 line casework solution but I seriously doubt its the intended:
otherwise split into low segments (elements from ) and high segments (elements from ) which alternate (Starting segment type and which segment goes to for odd depend on whether or not). Sort each segment internally to ensure only one endpoint is a local maxima / minima (careful about sorting order for endpoints)
-
first judge if a > b or a < b
set maxx = n, minx = 1
if a > b then fill a[1] (the array start with 1) with minx, then minx++
else then fill a[1] with maxx, then maxx--;
then i from 2 to a + b + 1, fill a[i] with minx or maxx
and from a + b + 2 to n, fill a[i] with the rest numbers in ascending or descending order
depending on the a[a + b + 1] is max or min
#include <bits/stdc++.h> using namespace std; int t, n, a, b, q, minq, maxq, a1, b1; int x[100010]; int main() { cin >> t; while (t--) { memset(x, 0, sizeof(x)); cin >> n >> a >> b; a1 = a, b1 = b; if (abs(a - b) > 1 || a + b > n - 2) { cout << "-1" << endl; continue; } if (a > b) q = 1; else q = 0; minq = 1, maxq = n; if (q == 1) x[1] = minq++; else x[1] = maxq--; for (int i = 2; i <= n; i++) { if (a == 0 && b == 0) { //if (q == 0) // x[i] = minq++; //else // x[i] = maxq--; break; } if (q == 1) x[i] = maxq--, a--; else x[i] = minq++, b--; q ^= 1; } if (q == 0) { for (int i = a1 + b1 + 2; i <= n; i++) x[i] = maxq--; } else { for (int i = a1 + b1 + 2; i <= n; i++) x[i] = minq++; } for (int i = 1; i <= n; i++) printf("%d ", x[i]); printf("\n"); } return 0; }
3 days ago, # |
For 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.
3 days ago, # |
Share my solution to D:
3 days ago, # |
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.
-
Actually there is no need of FFT in problem D.
let a be the number of
?W
andW?
, b be the number of?B
andB?
, c be the number of??
, and k be the number ofBB
-WW
. Then use DP. Let 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
orW?
means so we can multiply it with . Other cases are similar, and finally we get , the answer is the coef of the term . It turns out to be . And then we need to exclude the cases when onlyWB
andBW
exist. It's easy to solve it. We just need to minus and check if all strings can be one ofWB
orBW
.
Total time complexity: . -
The 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.
3 days ago, # |
3 days ago, # |
I've won, but at what cost? :(
3 days ago, # |
The pretests for D were really bad. There were no pretests containing very obvious corner cases like all characters equal to '?'
3 days ago, # |
3 days ago, # |
I 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??????????????????????
3 days ago, # |
Good contest full of adhoc problem. But I was not in good state..
3 days ago, # |
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 solutions with FFT, you could have used modulo to slow down such solutions.
G is a zero-idea implementation task. I really don't like it.
Bro bro wai petest so stronk??
int ma=0,mb=0;
forinc(i,1,n) a[i]=in,ma=max(ma,a[i]);
forinc(i,1,n) b[i]=in,mb=max(mb,a[i]);
3 days ago, # |
HOW weak the C's pretest cases!!!HOW DARE YOU!!!
3 days ago, # |
Good contest! Interesting problems!
3 days ago, # |
Ratings updated preliminarily. We will remove cheaters and update the ratings again soon!
-
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.
TadijaSebez , Bugman 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!
3 days ago, # |
In problem C, i made two sorted arrays based on the ranks of players in the two maps respectively. I felt like there must be a common rank for both arrays after which the participants can never win. I tried to implement this using sets. The pretest passed, but it ultimately failed on test-21. Can anyone plz tell me if my logic is wrong or the use of sets. I read the tutorial but it is explaining the use of maps of some sort.
3 days ago, # |
love this contest
3 days ago, # |
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]
3 days ago, # |
Hint for C.
Attention!
Your solution 138768240 for the problem 1608B significantly coincides with solutions shivam10025/138768240, Pptsagar/138769448. Such a coincidence is a clear rules violation. Note that unintentional leakage is also a violation. For example, do not use ideone.com with the default settings (public access to your code). If you have conclusive evidence that a coincidence has occurred due to the use of a common source published before the competition, write a comment to post about the round with all the details. More information can be found at http://codeforces.com/blog/entry/8790. Such violation of the rules may be the reason for blocking your account or other penalties. In case of repeated violations, your account may be blocked.
sir , you send me this mail but you can check that my submission is maded 10 minute before pptsagar, i make a request to you to revisite the matter and reply me my submissions ppt sagar submissions(https://codeforces.com/submissions/Pptsagar)
39 hours ago, # |
Attention!
Your solution 138754057 for the problem 1608B significantly coincides with solutions XYZcoder/138754057, procoder_aj/138755712. Such a coincidence is a clear rules violation. Note that unintentional leakage is also a violation. For example, do not use ideone.com with the default settings (public access to your code). If you have conclusive evidence that a coincidence has occurred due to the use of a common source published before the competition, write a comment to post about the round with all the details. More information can be found at http://codeforces.com/blog/entry/8790. Such violation of the rules may be the reason for blocking your account or other penalties. In case of repeated violations, your account may be blocked.
Sir/Mam, You send me this mail. I regret copying the code from procoder_aj. He was using public coding platforms. I, hereby request you to return his rating. I will make sure that this will not happen again. Thanks
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK