結果
| 問題 | No.1935 Water Simulation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-13 22:04:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 610 bytes |
| 記録 | |
| コンパイル時間 | 161 ms |
| コンパイル使用メモリ | 82,316 KB |
| 実行使用メモリ | 55,744 KB |
| 最終ジャッジ日時 | 2024-07-22 01:58:01 |
| 合計ジャッジ時間 | 2,431 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 4 |
ソースコード
from collections import defaultdict
v1, v2, v3, v4, N = map(int, input().split())
V = [v1, v2, v3, v4]
start = (v1, 0, 0, 0)
dist = defaultdict(lambda: -1)
status = defaultdict(tuple)
now = start
d, pt = 0, 0
while dist[now] == -1:
dist[now] = d
status[d] = now
next = list(now)
delta = min((V[(pt + 1) % 4] - now[(pt + 1) % 4]), now[pt])
next[pt] -= delta
next[(pt + 1) % 4] += delta
d, pt = d + 1, (pt + 1) % 4
now = tuple(next)
cycle_length = d - dist[now]
if N < d:
print(*status[d-1])
N -= d - cycle_length
N %= cycle_length
print(*status[d - cycle_length + N])