結果

問題 No.1935 Water Simulation
ユーザー tktk_snsntktk_snsn
提出日時 2022-05-13 21:49:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 502 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 71,696 KB
最終ジャッジ日時 2023-09-29 06:58:57
合計ジャッジ時間 3,838 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 71 ms
71,396 KB
testcase_05 AC 66 ms
71,372 KB
testcase_06 AC 68 ms
71,420 KB
testcase_07 AC 66 ms
71,300 KB
testcase_08 AC 66 ms
71,300 KB
testcase_09 AC 66 ms
71,336 KB
testcase_10 AC 67 ms
71,352 KB
testcase_11 AC 68 ms
71,448 KB
testcase_12 AC 67 ms
71,116 KB
testcase_13 AC 68 ms
71,404 KB
testcase_14 AC 66 ms
71,468 KB
testcase_15 AC 67 ms
71,444 KB
testcase_16 AC 65 ms
71,220 KB
testcase_17 AC 68 ms
70,932 KB
testcase_18 AC 67 ms
71,316 KB
testcase_19 AC 67 ms
71,192 KB
testcase_20 AC 66 ms
71,400 KB
testcase_21 AC 66 ms
71,404 KB
testcase_22 AC 68 ms
71,304 KB
testcase_23 AC 69 ms
71,380 KB
testcase_24 AC 70 ms
71,316 KB
testcase_25 AC 69 ms
71,224 KB
testcase_26 AC 72 ms
71,220 KB
testcase_27 AC 69 ms
71,252 KB
testcase_28 AC 68 ms
71,132 KB
testcase_29 AC 66 ms
71,400 KB
testcase_30 AC 67 ms
71,492 KB
testcase_31 AC 66 ms
71,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""
高々comb(103, 3)通り
"""

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


W = [0] * 4
W[0] = X[0]

used = set()
memo = []

for i in range(10 ** 9):
    used.add(tuple(W))
    memo.append(tuple(W))
    i %= 4
    j = (i + 1) % 4
    wi = W[i]
    wj = X[j] - W[j]
    d = min(wi, wj)
    W[i] -= d
    W[j] += d
    if tuple(W) in used:
        break


if len(memo) > N:
    assert(0)
    print(*memo[N])
    exit()

f = memo.index(tuple(W))
s = len(memo) - f
N -= f
N %= s
print(*memo[f + N])
0