結果

問題 No.1935 Water Simulation
ユーザー rlangevinrlangevin
提出日時 2023-06-07 12:25:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 756 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 71,568 KB
最終ジャッジ日時 2023-08-28 15:11:57
合計ジャッジ時間 4,157 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 70 ms
71,292 KB
testcase_05 AC 70 ms
71,380 KB
testcase_06 AC 70 ms
71,540 KB
testcase_07 AC 69 ms
71,204 KB
testcase_08 AC 71 ms
71,304 KB
testcase_09 AC 68 ms
71,296 KB
testcase_10 AC 70 ms
71,448 KB
testcase_11 AC 69 ms
71,176 KB
testcase_12 AC 68 ms
70,944 KB
testcase_13 AC 69 ms
71,188 KB
testcase_14 AC 69 ms
71,300 KB
testcase_15 AC 70 ms
71,568 KB
testcase_16 AC 70 ms
71,196 KB
testcase_17 AC 70 ms
71,564 KB
testcase_18 AC 70 ms
71,316 KB
testcase_19 AC 70 ms
71,564 KB
testcase_20 AC 69 ms
70,988 KB
testcase_21 AC 69 ms
71,368 KB
testcase_22 AC 69 ms
71,316 KB
testcase_23 AC 70 ms
71,512 KB
testcase_24 AC 72 ms
71,336 KB
testcase_25 AC 71 ms
71,564 KB
testcase_26 AC 71 ms
71,460 KB
testcase_27 AC 71 ms
71,332 KB
testcase_28 AC 70 ms
71,144 KB
testcase_29 AC 71 ms
71,500 KB
testcase_30 AC 70 ms
71,360 KB
testcase_31 AC 70 ms
71,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

V = list(map(int, input().split()))
N = V.pop()

D = dict()
now = (V[0], 0, 0, 0)
cnt = 0
D[now] = cnt
L = [now]
while True:
    # print("test", cnt, now)
    i = cnt%4
    ni = (i + 1)%4
    nex = [0] * 4
    if now[i] + now[ni] >= V[ni]:
        nex[ni] = V[ni]
        nex[i] = now[i] + now[ni] - V[ni]
    else:
        nex[ni] = now[i] + now[ni]
        nex[i] = 0

    for j in range(4):
        if j not in [i, ni]:
            nex[j] = now[j]
    nex = tuple(nex)
    if nex in D:
        N -= D[nex]
        loop = cnt - D[nex] + 1
        L = L[D[nex]:]
        print(*L[N%loop])
        exit()
    else:
        cnt += 1
        D[nex] = cnt
        L.append(nex)
        if cnt == N:
            print(*nex)
            exit()
        now = nex
0