結果

問題 No.1935 Water Simulation
ユーザー 加藤優太
提出日時 2022-05-13 23:15:00
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 857 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 17,696 KB
最終ジャッジ日時 2024-07-22 03:32:28
合計ジャッジ時間 3,699 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 1 TLE * 1 -- * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

def operation(containers, V):
    count = 0
    i = 0
    while count < N:
        previous = i
        if previous != 3:
            next = i + 1
        else:
            next = 0
        if V[next] < containers[previous] + containers[next]:
            containers[previous] = containers[previous] - (V[next] - containers[next])
            containers[next] = V[next]
        else:
            containers[next] = containers[previous] + containers[next]
            containers[previous] = 0
        count += 1
        i += 1
        if i == 4:
            i = 0
    return containers


v1, v2, v3, v4, N = map(int, input().split())
V = [v1, v2, v3, v4]
containers = [v1, 0, 0, 0]

containers = operation(containers, V)
print(
    str(containers[0])
    + " "
    + str(containers[1])
    + " "
    + str(containers[2])
    + " "
    + str(containers[3])
)
0