結果
| 問題 | No.1935 Water Simulation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-20 08:10:57 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 557 bytes |
| 記録 | |
| コンパイル時間 | 256 ms |
| コンパイル使用メモリ | 96,108 KB |
| 実行使用メモリ | 79,360 KB |
| 最終ジャッジ日時 | 2026-08-20 08:11:04 |
| 合計ジャッジ時間 | 4,224 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 8 |
ソースコード
V0,V1,V2,V3,N = map(int,input().split())
V = [V0,V1,V2,V3]
cnt = 0
A = set()
A.add((V0,0,0,0))
B = [V0,0,0,0]
while cnt<N:
ind = cnt%4
indn = (cnt+1)%4
delta = min(B[ind],V[indn]-B[indn])
B[ind] = B[ind]-delta
B[indn] = B[indn]+delta
a = tuple(B)
if a in A:break
A.add(a)
cnt += 1
if cnt==N:
print(*B)
else:
r = (N-cnt)%4
for _ in range(r):
ind = cnt%4
indn = (cnt+1)%4
delta = min(B[ind],V[indn]-B[indn])
B[ind] -= delta
B[indn] += delta
cnt += 1
print(*B)