Thank you for participating in our contest! We hope you enjoyed it. Implementations will be added soon (when Codeforces lets authors submit solutions!).
Please let us know what you thought of the problems by voting!
1758A - SSeeeeiinngg DDoouubbllee
Thank you for participating in our contest! We hope you enjoyed it. Implementations will be added soon (when Codeforces lets authors submit solutions!).
Please let us know what you thought of the problems by voting!
1758A - SSeeeeiinngg DDoouubbllee
omg hi Codeforces!
I've been meaning to write a blog about this interesting, but not (as far as I know) documented trick for a while. I've decided to call it the Amogus trick after the first problem where I encountered and used it.
First, let's solve an easier version of this problem, where we just need to find whether there exists a configuration of player roles (i.e. Crewmate or Imposter) such that all the statements made by players so far are true.
Let's look at the two different types of statements made by players separately.
Case 1: Player $$$i$$$ claims Player $$$j$$$ is a crewmate. Now, if Player $$$i$$$ is a crewmate, Player $$$j$$$ will also be a crewmate. Similarly, if Player $$$i$$$ is an imposter, Player $$$j$$$ will also be an imposter. The reversed versions of these statements are also true. Using this, we can create a virtual "edge" between Players $$$i$$$ and $$$j$$$, as their roles in the game will always be the same. More formally, for those familiar with 2-SAT or otherwise, we create the equivalency $$$v_i = v_j$$$.
Case 2: Player $$$i$$$ claims Player $$$j$$$ is an imposter. Now, if Player $$$i$$$ is a crewmate, Player $$$j$$$ will be an imposter. Similarly, if Player $$$i$$$ is an imposter, Player $$$j$$$ will be a crewmate. We can create a virtual "anti-edge" between Players $$$i$$$ and $$$j$$$, as their roles in the game will always be the different. More formally, we create the equivalency $$$v_i = !v_j$$$.
Adding edges is easy, we can just use normal DSU. But how do we deal with anti-edges? This is where the Amogus Trick comes in!
We can deal with these anti-edges by creating a DSU with $$$2n$$$ nodes, where nodes $$$1$$$ to $$$n$$$ represent player $$$i$$$ being a crewmate, and nodes $$$n + 1$$$ to $$$2n$$$ represent player $$$i - n$$$ being an imposter. Now, let's look at those cases again.
Case 1 results in both players having the same role in the game. Therefore, when such a statement is said, we can unite nodes $$$i$$$ and $$$j$$$, and similarly, unite nodes $$$i + n$$$ and $$$j + n$$$.
Case 2 results in both players having differing roles in the game. Therefore, when such a statement is said, we can unite nodes $$$i$$$ and $$$j + n$$$, and similarly, unite nodes $$$i + n$$$ and $$$j$$$.
Testcases 2 & 3 of the sample input in the problem, respectively, visualised with the Amogus trick:
So, how can we solve our reduced problem with this? Note that a player can be exactly one of $$$\{ \text{Crewmate, Imposter} \}$$$, so a configuration is invalid iff for some $$$1 \le i \le n$$$, nodes $$$i$$$ and $$$i + n$$$ are in the same component in our DSU. This is the only condition we need to check, as since the edges we add to our DSU are symmetric, there will always be a valid assignment of roles.
It's not too difficult to extend this idea to solve our original problem.
Using this trick, we can solve a variety of other problems, such as dynamic bipartiteness checking, and it can often be paired with other modifications of DSU such as with support for rollbacks.
Problems are ordered (roughly) in ascending order of difficulty.
A special thank you to kostia244, BucketPotato, fishy15 and AlperenT for providing lots of feedback and/or sample problems!
As the title suggests, I would like to propose that Codeforces keep its extra (late) registration open throughout the contest. Unlike AtCoder, where such a system is problematic due to its penalty system, Codeforces' penalty for submissions increases every minute, and it is no different to registering 2 days before the contest, so it isn't exploitable.
I don't see any reason not to have this, unless it is too much of a technical difficulty due to room allocation?
E: Pinging MikeMirzayanov as this seems popular, also bump for exposure.
Hey there Codeforces!
flamestorm and I are glad to invite you to our first-ever Codeforces round, Codeforces Round 742 (Div. 2), which will be held on Sep/05/2021 17:35 (Moscow time). This round will be rated for participants with rating lower than 2100.
Special shoutouts to:
adedalic, for his fantastic coordination and translation of the round!
MikeMirzayanov, for creating the amazing Codeforces and Polygon platforms!
dorijanlendvaj, awoo, YouKn0wWho, PurpleCrayon, phattd, ijxjdjd, stefdasca, tenth, Aaeria, Eyed, kalki411, Shinchan01, BRCode, namanbansal013, Urvuk3, mudkip, richy6, and tdpencil for testing the round, catching any mistakes and providing lots of valuable feedback! We tried to get a large range of testers with different coding experiences so that everybody enjoys the round.
stefdasca once again, for creating video editorials which will be available after the contest!
saarang, not because he contributed anything to the round, but because he would annoy me for months if I didn't mention him here.
And you, the user, for upvoting this blog and giving me contribution participating in this contest!
You will have 2 hours to work on (and solve!) 6 problems. At most one of the problems will be interactive. Make sure to read this blog and familiarize yourself with these types of problems before the round! You are highly encouraged to read all the problems ;).
UPD: The score distribution is 500 — 1000 — 1500 — 1750 — 2250 — 2750.
Good luck, and see you on the scoreboard!
UPD: Editorial is out!
UPD: Congrats to the winners!
Div. 2 (the only 5 contestants to solve the whole set!):
Div. 1 + 2:
We hope you enjoyed the round. See you soon!
I'd like to preface this by saying I know that the world doesn't revolve around IOI participants or whatever, this is just a suggestion. There is an upcoming Div. 1 and Div. 2 round (#728) scheduled for the 25th of June 15:35 UTC. I think Div. 1 rounds are pretty rare as it is at the moment, and that most serious IOI competitors practice on Codeforces anyways, so it would be nice if it could be rescheduled to some day that doesn't clash with one of the competition days. That way, it can also serve as a nice practice contest for the IOI :)
E: This topic seems to be supported by many in the Codeforces community (judging from the upvotes), I think it's fair to tag MikeMirzayanov now.
E2: adedalic too!