結果
| 問題 | No.1935 Water Simulation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-20 08:27:09 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 788 bytes |
| 記録 | |
| コンパイル時間 | 544 ms |
| コンパイル使用メモリ | 96,112 KB |
| 実行使用メモリ | 89,856 KB |
| 最終ジャッジ日時 | 2026-08-20 08:27:19 |
| 合計ジャッジ時間 | 7,534 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 28 |
ソースコード
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
cnt += 1
a = tuple(B)
if a in A:break
A.add(a)
if cnt==N:
print(*B)
else:
B1 = B[:]
T = cnt
while True:
ind = T%4
indn = (T+1)%4
delta = min(B1[ind],V[indn]-B1[indn])
B1[ind] -= delta
B1[indn] += delta
T += 1
if B1==B:break
T -= cnt
r = (N-cnt)%T
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)