結果

問題 No.1935 Water Simulation
ユーザー 👑 H20H20
提出日時 2022-05-13 21:44:59
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 809 bytes
コンパイル時間 362 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 76,396 KB
最終ジャッジ日時 2023-09-29 09:59:54
合計ジャッジ時間 4,749 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
76,396 KB
testcase_01 AC 96 ms
76,232 KB
testcase_02 AC 92 ms
71,488 KB
testcase_03 AC 89 ms
71,720 KB
testcase_04 AC 91 ms
71,632 KB
testcase_05 AC 91 ms
71,588 KB
testcase_06 AC 93 ms
71,740 KB
testcase_07 AC 91 ms
71,456 KB
testcase_08 AC 89 ms
71,428 KB
testcase_09 AC 92 ms
71,668 KB
testcase_10 AC 91 ms
71,720 KB
testcase_11 AC 91 ms
71,548 KB
testcase_12 AC 88 ms
71,352 KB
testcase_13 AC 90 ms
71,352 KB
testcase_14 AC 91 ms
71,884 KB
testcase_15 AC 91 ms
71,776 KB
testcase_16 AC 96 ms
71,504 KB
testcase_17 AC 93 ms
71,500 KB
testcase_18 AC 93 ms
71,592 KB
testcase_19 AC 93 ms
71,828 KB
testcase_20 AC 95 ms
71,592 KB
testcase_21 AC 95 ms
71,548 KB
testcase_22 AC 92 ms
71,680 KB
testcase_23 AC 94 ms
71,588 KB
testcase_24 AC 94 ms
71,780 KB
testcase_25 AC 97 ms
71,768 KB
testcase_26 AC 99 ms
71,560 KB
testcase_27 AC 94 ms
71,676 KB
testcase_28 AC 91 ms
71,676 KB
testcase_29 AC 92 ms
71,656 KB
testcase_30 AC 93 ms
71,684 KB
testcase_31 AC 92 ms
71,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
V1,V2,V3,V4,N = map(int, input().split())
L1,L2,L3,L4 = V1,0,0,0
D = collections.defaultdict(lambda:-1)
i = 0

D[(L1,L2,L3,L4,i%4)]=0

while i<N:
    if i%4==0:
        if L1+L2<=V2:
            L1,L2=0,L1+L2
        else:
            L1,L2=L1+L2-V2,V2        
    if i%4==1:
        if L2+L3<=V3:
            L2,L3=0,L2+L3
        else:
            L2,L3=L2+L3-V3,V3       
    if i%4==2:
        if L3+L4<=V4:
            L3,L4=0,L3+L4
        else:
            L3,L4=L3+L4-V4,V4       
    if i%4==3:
        if L4+L1<=V1:
            L4,L1=0,L4+L1
        else:
            L4,L1=L4+L1-V1,V1
    i+=1
    if D[(L1,L2,L3,L4,i%4)]>=0:
        temp =  i-D[(L1,L2,L3,L4,i%4)]
        temp2 = (N-i)//temp
        i+=temp2*temp
        continue
    D[(L1,L2,L3,L4,i%4)]=i


print(L1,L2,L3,L4)
0