Comments

Well, it was perhaps the most serious problem though... The answer is the output of the quantum gate with given input (the lowest bit is in the first row).

I found unitary decomposition (Decompose a unitary matrix to several rotations) is really useful. It makes solving A1 B1 B2 trivial (although quite slow...). You just need to find an appropriate unitary matrix that solves the problem.

For D* problems, If you implement a gate that could swap 2 states, them some of them become really easy. For example, to solve D4 you just need to swap some rows and columns of D3, and D5 is basically D2.

Are the strict time limits in some problems intended? For example, in Problem B2 the solution gets called 1000 times but the time limit is only 1 second. It seems like you could get TLE just because you use an additional Qubit or perhaps two quantum gates in those problems.

Maybe this could be a solution? You may pre-define as many as you want in your default code so you won't have to type it every time.

On Eran → Codeforces Round #365 (Div. 2), 10 years ago
0

Q_Q

On ADJA → Codeforces Round #294 (Div. 2), 12 years ago
+16

I think he is just acting like the character Akashi Seijuro... Those words were all originally from the anime....