結果

問題 No.1935 Water Simulation
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-05-13 22:37:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 76,860 KB
最終ジャッジ日時 2023-09-29 10:03:00
合計ジャッジ時間 4,850 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
76,860 KB
testcase_01 AC 99 ms
76,836 KB
testcase_02 AC 93 ms
71,672 KB
testcase_03 AC 91 ms
71,852 KB
testcase_04 AC 94 ms
71,616 KB
testcase_05 AC 92 ms
71,660 KB
testcase_06 AC 90 ms
71,856 KB
testcase_07 AC 90 ms
71,656 KB
testcase_08 AC 91 ms
71,652 KB
testcase_09 AC 90 ms
71,780 KB
testcase_10 AC 91 ms
71,700 KB
testcase_11 AC 92 ms
71,496 KB
testcase_12 AC 92 ms
71,632 KB
testcase_13 AC 92 ms
71,472 KB
testcase_14 AC 97 ms
71,488 KB
testcase_15 AC 91 ms
71,728 KB
testcase_16 AC 91 ms
71,632 KB
testcase_17 AC 90 ms
71,492 KB
testcase_18 AC 92 ms
71,780 KB
testcase_19 AC 93 ms
71,648 KB
testcase_20 AC 91 ms
71,508 KB
testcase_21 AC 95 ms
71,888 KB
testcase_22 AC 90 ms
71,624 KB
testcase_23 AC 91 ms
71,764 KB
testcase_24 AC 90 ms
71,732 KB
testcase_25 AC 90 ms
71,648 KB
testcase_26 AC 91 ms
71,628 KB
testcase_27 AC 91 ms
71,488 KB
testcase_28 AC 92 ms
71,620 KB
testcase_29 AC 90 ms
71,624 KB
testcase_30 AC 91 ms
71,664 KB
testcase_31 AC 90 ms
71,668 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