結果

問題 No.1935 Water Simulation
ユーザー tktk_snsntktk_snsn
提出日時 2022-05-13 21:41:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 488 bytes
コンパイル時間 870 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 71,708 KB
最終ジャッジ日時 2023-09-29 06:43:41
合計ジャッジ時間 4,206 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 76 ms
71,376 KB
testcase_05 AC 75 ms
71,416 KB
testcase_06 AC 75 ms
71,340 KB
testcase_07 AC 75 ms
71,332 KB
testcase_08 AC 75 ms
70,980 KB
testcase_09 AC 74 ms
71,368 KB
testcase_10 AC 75 ms
71,076 KB
testcase_11 AC 74 ms
71,284 KB
testcase_12 AC 74 ms
71,504 KB
testcase_13 AC 73 ms
71,344 KB
testcase_14 AC 74 ms
71,432 KB
testcase_15 AC 75 ms
71,168 KB
testcase_16 AC 72 ms
71,492 KB
testcase_17 AC 73 ms
71,348 KB
testcase_18 AC 73 ms
71,264 KB
testcase_19 AC 74 ms
71,292 KB
testcase_20 AC 74 ms
71,080 KB
testcase_21 AC 74 ms
71,448 KB
testcase_22 AC 75 ms
71,348 KB
testcase_23 AC 74 ms
71,080 KB
testcase_24 AC 75 ms
71,428 KB
testcase_25 AC 73 ms
71,332 KB
testcase_26 AC 77 ms
71,364 KB
testcase_27 AC 75 ms
71,016 KB
testcase_28 AC 75 ms
71,336 KB
testcase_29 AC 74 ms
71,328 KB
testcase_30 AC 74 ms
71,372 KB
testcase_31 AC 76 ms
71,348 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:
    print(*memo[N])
    exit()

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