結果
問題 |
No.1935 Water Simulation
|
ユーザー |
|
提出日時 | 2022-05-13 21:51:15 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 534 bytes |
コンパイル時間 | 235 ms |
コンパイル使用メモリ | 82,660 KB |
実行使用メモリ | 53,708 KB |
最終ジャッジ日時 | 2024-07-22 01:34:34 |
合計ジャッジ時間 | 2,550 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 WA * 4 |
ソースコード
import sys 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] C = [0] * 4 C[0] = V[0] history = set([]) 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 tuple(C) in history and (n + 1) % 4 == N % 4: break history.add(tuple(C)) print(" ".join(str(c) for c in C))