結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 88 ms
71,448 KB
testcase_05 AC 89 ms
71,480 KB
testcase_06 AC 90 ms
71,412 KB
testcase_07 AC 90 ms
71,584 KB
testcase_08 AC 90 ms
71,424 KB
testcase_09 AC 90 ms
71,440 KB
testcase_10 AC 89 ms
71,488 KB
testcase_11 AC 88 ms
71,468 KB
testcase_12 AC 88 ms
71,108 KB
testcase_13 AC 88 ms
71,408 KB
testcase_14 AC 90 ms
71,348 KB
testcase_15 AC 89 ms
71,428 KB
testcase_16 AC 90 ms
71,352 KB
testcase_17 AC 91 ms
71,428 KB
testcase_18 AC 89 ms
71,360 KB
testcase_19 AC 89 ms
71,568 KB
testcase_20 AC 87 ms
71,260 KB
testcase_21 AC 88 ms
71,332 KB
testcase_22 AC 87 ms
71,416 KB
testcase_23 AC 87 ms
71,588 KB
testcase_24 AC 89 ms
71,520 KB
testcase_25 AC 89 ms
71,464 KB
testcase_26 AC 90 ms
71,332 KB
testcase_27 AC 89 ms
71,416 KB
testcase_28 AC 89 ms
71,408 KB
testcase_29 AC 89 ms
71,560 KB
testcase_30 AC 89 ms
71,472 KB
testcase_31 AC 88 ms
71,584 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[(tuple(l))] = 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))
    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:
        print(*key.split("-"))
        break
0