結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 98 ms
71,460 KB
testcase_05 AC 95 ms
71,440 KB
testcase_06 AC 95 ms
71,176 KB
testcase_07 AC 97 ms
71,456 KB
testcase_08 AC 94 ms
71,264 KB
testcase_09 AC 94 ms
71,488 KB
testcase_10 AC 92 ms
71,424 KB
testcase_11 AC 93 ms
71,428 KB
testcase_12 AC 97 ms
71,452 KB
testcase_13 AC 99 ms
71,396 KB
testcase_14 AC 95 ms
71,348 KB
testcase_15 AC 97 ms
71,344 KB
testcase_16 AC 97 ms
71,120 KB
testcase_17 AC 95 ms
71,432 KB
testcase_18 AC 94 ms
71,212 KB
testcase_19 AC 93 ms
71,084 KB
testcase_20 AC 96 ms
71,480 KB
testcase_21 AC 99 ms
71,136 KB
testcase_22 AC 99 ms
71,472 KB
testcase_23 AC 94 ms
71,508 KB
testcase_24 AC 95 ms
71,428 KB
testcase_25 AC 96 ms
71,452 KB
testcase_26 AC 99 ms
71,416 KB
testcase_27 AC 96 ms
71,452 KB
testcase_28 AC 94 ms
71,444 KB
testcase_29 AC 94 ms
71,568 KB
testcase_30 AC 95 ms
71,456 KB
testcase_31 AC 94 ms
71,456 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
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