結果

問題 No.1935 Water Simulation
ユーザー Issei MoriIssei Mori
提出日時 2022-05-13 22:27:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 76,516 KB
最終ジャッジ日時 2023-09-29 10:02:03
合計ジャッジ時間 4,717 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
76,352 KB
testcase_01 AC 98 ms
76,516 KB
testcase_02 AC 99 ms
76,056 KB
testcase_03 AC 102 ms
76,056 KB
testcase_04 AC 99 ms
76,124 KB
testcase_05 AC 99 ms
76,396 KB
testcase_06 AC 99 ms
76,452 KB
testcase_07 AC 99 ms
76,248 KB
testcase_08 AC 98 ms
76,372 KB
testcase_09 AC 99 ms
76,352 KB
testcase_10 AC 98 ms
76,448 KB
testcase_11 AC 96 ms
76,252 KB
testcase_12 AC 98 ms
76,396 KB
testcase_13 AC 102 ms
76,448 KB
testcase_14 AC 97 ms
76,372 KB
testcase_15 AC 98 ms
76,340 KB
testcase_16 AC 98 ms
76,064 KB
testcase_17 AC 96 ms
76,420 KB
testcase_18 AC 98 ms
76,308 KB
testcase_19 AC 97 ms
76,452 KB
testcase_20 AC 98 ms
76,048 KB
testcase_21 AC 96 ms
76,328 KB
testcase_22 AC 99 ms
76,248 KB
testcase_23 AC 96 ms
76,128 KB
testcase_24 AC 98 ms
76,396 KB
testcase_25 AC 97 ms
76,060 KB
testcase_26 AC 97 ms
76,044 KB
testcase_27 AC 99 ms
76,452 KB
testcase_28 AC 99 ms
76,308 KB
testcase_29 AC 93 ms
71,528 KB
testcase_30 AC 95 ms
76,368 KB
testcase_31 AC 98 ms
76,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)


def get_list(ty=int):
    return list(map(ty, input().split()))


def get_int():
    return int(input())


def get_str():
    return input()


V1, V2, V3, V4, N = get_list()

V = [V1, V2, V3, V4]


def smart(V):
    C = [0] * 4
    C[0] = V[0]
    history = defaultdict(int)
    for n in range(N):
        a = n % 4
        b = (n + 1) % 4
        diff = min(V[b] - C[b], C[a])
        C[a] -= diff
        C[b] += diff
        if history[tuple(C)] >= 100 and (n + 1) % 4 == N % 4:
            break
        history[tuple(C)] += 1

    return C


print(" ".join(str(c) for c in smart(V)))
0