結果

問題 No.1935 Water Simulation
ユーザー ikomaikoma
提出日時 2022-05-13 22:17:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 416 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 86,724 KB
実行使用メモリ 71,244 KB
最終ジャッジ日時 2023-09-29 07:41:51
合計ジャッジ時間 4,037 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 73 ms
71,108 KB
testcase_05 AC 73 ms
71,244 KB
testcase_06 AC 75 ms
71,180 KB
testcase_07 AC 75 ms
71,068 KB
testcase_08 AC 75 ms
70,996 KB
testcase_09 AC 77 ms
71,140 KB
testcase_10 AC 78 ms
71,192 KB
testcase_11 AC 74 ms
71,044 KB
testcase_12 AC 72 ms
71,168 KB
testcase_13 AC 74 ms
70,984 KB
testcase_14 AC 74 ms
71,068 KB
testcase_15 AC 73 ms
70,976 KB
testcase_16 AC 73 ms
71,240 KB
testcase_17 AC 71 ms
71,136 KB
testcase_18 AC 74 ms
71,088 KB
testcase_19 AC 76 ms
71,136 KB
testcase_20 AC 78 ms
71,232 KB
testcase_21 AC 74 ms
71,236 KB
testcase_22 AC 74 ms
71,064 KB
testcase_23 AC 74 ms
71,044 KB
testcase_24 AC 75 ms
70,788 KB
testcase_25 AC 74 ms
71,108 KB
testcase_26 AC 75 ms
70,924 KB
testcase_27 AC 75 ms
71,104 KB
testcase_28 AC 74 ms
71,104 KB
testcase_29 AC 77 ms
71,140 KB
testcase_30 AC 77 ms
71,004 KB
testcase_31 AC 75 ms
70,920 KB
権限があれば一括ダウンロードができます

ソースコード

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