結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 67 ms
71,280 KB
testcase_05 AC 67 ms
71,256 KB
testcase_06 AC 67 ms
71,384 KB
testcase_07 AC 68 ms
70,940 KB
testcase_08 AC 80 ms
71,056 KB
testcase_09 AC 67 ms
71,332 KB
testcase_10 AC 68 ms
71,120 KB
testcase_11 AC 67 ms
71,300 KB
testcase_12 AC 65 ms
71,324 KB
testcase_13 AC 66 ms
71,472 KB
testcase_14 AC 66 ms
71,428 KB
testcase_15 AC 67 ms
71,316 KB
testcase_16 AC 69 ms
71,416 KB
testcase_17 AC 70 ms
70,944 KB
testcase_18 AC 67 ms
71,300 KB
testcase_19 AC 66 ms
71,312 KB
testcase_20 AC 67 ms
71,336 KB
testcase_21 AC 66 ms
71,356 KB
testcase_22 AC 67 ms
71,296 KB
testcase_23 AC 67 ms
71,512 KB
testcase_24 AC 68 ms
71,056 KB
testcase_25 AC 67 ms
71,340 KB
testcase_26 AC 67 ms
70,976 KB
testcase_27 AC 71 ms
71,284 KB
testcase_28 AC 68 ms
70,940 KB
testcase_29 AC 69 ms
71,484 KB
testcase_30 AC 66 ms
71,252 KB
testcase_31 AC 66 ms
71,308 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):
    if i == N:
        print(*W)
        exit()
    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


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