問題一覧 > 通常問題

No.250 atetubouのzetubou

レベル : / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 217
作問者 : is_eri23
お気に入りにしたユーザー ProblemId : 302 / 自分の提出
問題文最終更新日: 2026-06-25 08:27:29
atetubou's zetubou
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
yukicoder 1周年記念 復習コンテスト R1 (順位表) の他の問題:

Problem Statement

atetubou is in the middle of a contest.
He has somehow finished coding an implementation-heavy problem 3 minutes before the end of the contest and is about to submit it.
Since it would be sad if the code he worked so hard on got TLE, he decided to review the code to improve it.
The part of the current problem that seems likely to take time is where for loops are nested many times, as follows.

for i <- 0..$X$
for j <- 0..$X$
for k <- 0..$X$
for l <- 0..$X$
if i + j + k + l== $X$:
//program

atetubou noticed that this code can be improved as follows.

for i <- 0..$X$
for j <- 0..($X$-i)
for k <- 0..($X$ - i - j)
l <- $X$ - i - j - k
//program

By the time he finished the improvement, 10 seconds remained until the end of the contest.
atetubou estimated that the code will run in time if the //program part is entered $T$ times, so he decided to find out how many times it is entered.
Will atetubou's code safely get AC?
In the program part, the variable $X$ is not modified, and no loop is exited by break or the like.

Input

$Q$
$D_1$ $X_1$ $T_1$
$D_2$ $X_2$ $T_2$
$\vdots$
$D_Q$ $X_Q$ $T_Q$

$1 \leq Q \leq 10^{4}$ : the number of queries
$1 \leq D_{i} \leq 1500$ : the depth of the for loops in the code before the improvement; in the example above, D=4
$1 \leq X_{i} \leq 1500$ : the variable $X$ in the code
$0 \leq T_{i} \leq 10^{15}$: the upper limit on the number of times //program is entered. If it is entered more times than this, the code gets TLE.

Output

Print "AC" if it gets AC,
and "ZETUBOU" if it gets TLE <- (Not ZETSUBOU!)

Print a newline at the end.

Sample

Sample 1
Input
3
1 3 1
2 4 50
3 3 9
Output
AC
AC
ZETUBOU

Query 1: If the initial depth is 1, the improved code has only the single step i <- X.
Query 2: After the improvement, the depth of the for loops is 1, and program is entered 5 times, for 0 to 4.
Query 3: It is entered 10 times, for {i,j,k} = {0,0,3}, {0,1,2}, {0,2,1}, {0,3,0}, {1,0,2}, {1,1,1}, {1,2,0}, {2,0,1}, {2,1,0}, {3,0,0}, so it gets TLE.

Sample 2
Input
3
58 62 1000
12 34 56
987 65 1234
Output
ZETUBOU
ZETUBOU
ZETUBOU

atetubou fell into despair.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。