Codeforces Round #704 Genius's Gambit - Implementation + Construction

Solution

Better to be classified as implementation problem. Lots of details. Get Lots of WA.

Attention: You are not allowed to use leading zeros for $x$ and $y$.

So b--, because the first one must be 1.

Want have $k$ ones. So it's very clear that we can have this pair of $i$ and $j$. So that $i<j$ and $x_i=1,\ y_i=0, x_j=0, y_j=1$ and for any $p\in{(i,j)}$ have $x_p=y_p$. Then we just need adjust the position of $i$, $j$. Or return no.


Code

First two WA5 is cause by my misunderstanding of this problem. After that, just changed the code base on WA5's code. But the code structure still not changed.

Then I change the way to current code. It's much better. But still lots of WA.

Submission #112093913 - Codeforces
Codeforces. Programming competitions and contests, programming community
DigitalOcean Referral Badge 蜀ICP备19018968号