結果
問題 | No.1935 Water Simulation |
ユーザー |
![]() |
提出日時 | 2022-05-13 22:26:55 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 45 ms / 2,000 ms |
コード長 | 588 bytes |
コンパイル時間 | 213 ms |
コンパイル使用メモリ | 82,204 KB |
実行使用メモリ | 58,192 KB |
最終ジャッジ日時 | 2024-07-22 04:28:36 |
合計ジャッジ時間 | 2,348 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
V1,V2,V3,V4,N=map(int,input().split()) def solve(V1,V2,V3,V4,N): V=(V1,V2,V3,V4) s=[V1,0,0,0] st = {tuple(s):0} ts = [tuple(s)] i=0 cnt=0 while N>0: N-=1 cnt+=1 v=s[i] ib=i i+=1 if i>3:i=0 nxt=s[i] c=V[i] d=min(c-nxt,v) s[i]+=d s[ib]-=d t = tuple(s+[i]) if t in st: l=st[t] loop=cnt-l N%=loop s = ts[l+N] break st[t]=cnt ts.append(t[:4]) return s print(*solve(V1,V2,V3,V4,N))