結果
| 問題 |
No.1935 Water Simulation
|
| コンテスト | |
| ユーザー |
SidewaysOwl
|
| 提出日時 | 2022-05-13 22:17:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 591 bytes |
| コンパイル時間 | 362 ms |
| コンパイル使用メモリ | 82,296 KB |
| 実行使用メモリ | 55,660 KB |
| 最終ジャッジ日時 | 2024-07-22 02:16:11 |
| 合計ジャッジ時間 | 2,700 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 4 |
ソースコード
a,b,c,d,n = map(int,input().split())
v = [a,b,c,d]
l = [a] + [0] * 3
from collections import defaultdict
dic = defaultdict(int)
dic[(tuple(l))] = 0
start = 0
loop = 10 ** 18 + 1
for i in range(n):
ii = (i+1) % 4
val = min(l[i%4],v[ii]-l[ii])
l[i%4] -= val
l[ii] += val
tps = "-".join(map(str,l))
if tps in dic:
loop = dic[tp]- dic[tps] + 1
start = dic[tps]
break
else:
dic[tps] = i + 1
tp = tps
nn = n-start
nn %= loop
end = start + nn
for key in dic.keys():
if dic[key] == end:
print(*key.split("-"))
break
SidewaysOwl