結果

問題 No.1935 Water Simulation
ユーザー 粟野翔太粟野翔太
提出日時 2022-05-13 21:37:43
言語 PyPy3
(7.3.8)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 632 bytes
コンパイル時間 263 ms
使用メモリ 75,860 KB
最終ジャッジ日時 2023-02-21 18:38:10
合計ジャッジ時間 4,366 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 WA -
testcase_01 AC 83 ms
75,388 KB
testcase_02 AC 83 ms
75,752 KB
testcase_03 AC 83 ms
75,808 KB
testcase_04 AC 82 ms
75,788 KB
testcase_05 AC 84 ms
75,764 KB
testcase_06 AC 83 ms
75,544 KB
testcase_07 AC 83 ms
75,752 KB
testcase_08 AC 83 ms
75,776 KB
testcase_09 AC 83 ms
75,828 KB
testcase_10 AC 83 ms
75,820 KB
testcase_11 AC 83 ms
75,732 KB
testcase_12 AC 84 ms
75,556 KB
testcase_13 AC 83 ms
75,860 KB
testcase_14 AC 83 ms
75,692 KB
testcase_15 AC 82 ms
75,524 KB
testcase_16 AC 82 ms
75,760 KB
testcase_17 AC 85 ms
75,540 KB
testcase_18 AC 82 ms
75,820 KB
testcase_19 AC 83 ms
75,688 KB
testcase_20 AC 82 ms
75,412 KB
testcase_21 AC 82 ms
75,524 KB
testcase_22 AC 83 ms
75,748 KB
testcase_23 AC 83 ms
75,780 KB
testcase_24 AC 84 ms
75,820 KB
testcase_25 AC 82 ms
75,860 KB
testcase_26 AC 82 ms
75,440 KB
testcase_27 AC 82 ms
75,556 KB
testcase_28 AC 82 ms
75,820 KB
testcase_29 AC 83 ms
75,716 KB
testcase_30 AC 83 ms
75,548 KB
testcase_31 AC 83 ms
75,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#int(input())
#map(int, input().split())
#list(map(int, input().split()))

v = list(map(int, input().split()))

n = v.pop()

a, b = divmod(n, 4)

ans = [0] * 4

t = 0

w = [v[0]] + [0] * 3

# n = 2

while t < n:
    nv = list(w)
    for i in range(4):
        s = min(v[(i+1)%4] - nv[(i+1)%4], nv[i])
        nv[i] -= s
        nv[(i+1)%4] += s
        # print(nv)

    t += 1

    if nv == w:
        break
    w = list(nv)

if t == n:
    ans = list(w)
else:
    for i in range(b):
        s = min(v[(i+1)%4] - w[(i+1)%4], w[i])
        w[i] -= s
        w[(i+1)%4] += s
    ans = list(w)

print(" ".join(str(x) for x in ans))



0