結果

問題 No.1935 Water Simulation
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-05-13 22:37:28
言語 PyPy3
(7.9.16)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 838 ms
実行使用メモリ 81,128 KB
最終ジャッジ日時 2023-02-21 18:53:34
合計ジャッジ時間 5,691 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
81,128 KB
testcase_01 AC 112 ms
80,960 KB
testcase_02 AC 104 ms
76,024 KB
testcase_03 AC 107 ms
76,312 KB
testcase_04 AC 105 ms
76,088 KB
testcase_05 AC 102 ms
76,204 KB
testcase_06 AC 103 ms
76,040 KB
testcase_07 AC 105 ms
76,168 KB
testcase_08 AC 104 ms
76,104 KB
testcase_09 AC 105 ms
76,168 KB
testcase_10 AC 105 ms
76,304 KB
testcase_11 AC 106 ms
75,988 KB
testcase_12 AC 104 ms
76,284 KB
testcase_13 AC 106 ms
76,188 KB
testcase_14 AC 106 ms
75,984 KB
testcase_15 AC 104 ms
75,996 KB
testcase_16 AC 103 ms
75,932 KB
testcase_17 AC 103 ms
75,960 KB
testcase_18 AC 103 ms
76,188 KB
testcase_19 AC 103 ms
76,020 KB
testcase_20 AC 103 ms
76,120 KB
testcase_21 AC 104 ms
76,020 KB
testcase_22 AC 103 ms
75,992 KB
testcase_23 AC 102 ms
75,964 KB
testcase_24 AC 104 ms
76,024 KB
testcase_25 AC 103 ms
75,756 KB
testcase_26 AC 105 ms
76,228 KB
testcase_27 AC 106 ms
76,148 KB
testcase_28 AC 104 ms
76,152 KB
testcase_29 AC 104 ms
76,256 KB
testcase_30 AC 103 ms
75,752 KB
testcase_31 AC 105 ms
76,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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["-".join(map(str,l+[0]))] = 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+[(i+1)%4]))
    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:
        ans = list(key.split("-"))[:4]
        print(*ans)
        break
0