結果

問題 No.1935 Water Simulation
ユーザー ikoma
提出日時 2022-05-13 22:17:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 416 bytes
コンパイル時間 379 ms
コンパイル使用メモリ 82,076 KB
実行使用メモリ 54,100 KB
最終ジャッジ日時 2024-07-22 02:16:22
合計ジャッジ時間 2,451 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

V1,V2,V3,V4,N=map(int,input().split())
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)
    if t in st:
        l=st[t]
        loop=cnt-l
        N%=loop
        s = ts[l+N]
        break
    st[t]=cnt
    ts.append(t)
print(*s)

0