#P7608. [THUPC 2021] 挑战图灵奖

[THUPC 2021] 挑战图灵奖

Description

Today, your good friend—Minke—came to you and claimed that he proved “half” of the graph coloring problem, and he wants you to check whether his method is correct. If you can help him verify it, he will consider sharing the Turing Award prize money with you.

Minke claims that he solved the following problem: for an undirected graph with nn vertices, where all vertices are numbered 1,2,,n1,2,\ldots,n, there is an edge between two vertices if and only if their indices differ by at most kk in modulo nn. That is, there is an undirected edge between (x,y)(x,y) if and only if xyx \neq y and there exists an integer ii satisfying 1ik1 \le i \le k such that

(x+i)y(modn)(x+i) \equiv y \pmod n

or

(y+i)x(modn)(y+i) \equiv x \pmod n

He can quickly compute the chromatic number of this graph. As a judge, you only need to solve a decision problem: for each test case, Minke will give three positive integers nn, kk, and xx. When nn and kk are fixed (with the meanings described above), he believes the chromatic number of this graph is xx. You need to determine whether his answer is correct.

If you think his answer is correct, output one line Correct, but it doesn't necessarily mean that you can win the Turing Award.. If you think his answer is wrong, output Wrong, don't cheat me, you are too far away from the Turing Award. in the first line. To make your answer more convincing, you also need to output a character 0 or 1 in the second line: 0 means you think Minke’s answer is smaller than the actual chromatic number of this graph, and 1 means you think his answer is larger than the actual chromatic number. If you think this problem cannot be judged accurately with current computing power, output one line The problem is unsolvable, please stop cheating me, Mr.Minke..

Input Format

The input contains only one line, with three positive integers n,k,xn, k, x, with meanings as described in the statement.

Constraints: 1x,n101,000,0001 \le x, n \le 10^{1,000,000}, 1k1001 \le k \le 100. All inputs are positive integers, and for all testdata, nn can only satisfy n105n \le 10^5 or n10100n \ge 10^{100}.

Output Format

Output consists of 11 or 22 lines. The first line is your judgment result, in the format described in the statement.

If you successfully make a judgment and think Minke’s answer is wrong, then you need to output a character 0 or 1 in the second line: 0 means Minke’s answer is too small, and 1 means Minke’s answer is too large.

6 2 4

Wrong, don't cheat me, you are too far away from the Turing Award.
1

Hint

[Sample Explanation]

Obviously, coloring vertices 161 \sim 6 as 1,2,3,1,2,31, 2, 3, 1, 2, 3 is feasible, so when n=6n = 6 and k=2k = 2, the chromatic number is 33.

[Hint]

  1. If you have no idea, please read the Constraints in the statement again. It may help you solve the problem.
  2. Hint 1 may be useless.

[Source]

From the 2021 Tsinghua University Programming Contest and Collegiate Invitational (THUPC2021).

Solutions and other resources can be found at https://github.com/yylidiw/thupc_1/tree/master.

Translated by ChatGPT 5