結果

問題 No.1935 Water Simulation
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-05-13 21:55:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 577 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 71,956 KB
最終ジャッジ日時 2023-09-29 07:05:36
合計ジャッジ時間 4,870 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 95 ms
71,760 KB
testcase_05 AC 94 ms
71,648 KB
testcase_06 AC 93 ms
71,592 KB
testcase_07 AC 94 ms
71,616 KB
testcase_08 AC 94 ms
71,596 KB
testcase_09 AC 92 ms
71,540 KB
testcase_10 AC 94 ms
71,828 KB
testcase_11 AC 95 ms
71,576 KB
testcase_12 AC 93 ms
71,744 KB
testcase_13 AC 93 ms
71,612 KB
testcase_14 AC 93 ms
71,704 KB
testcase_15 AC 94 ms
71,792 KB
testcase_16 AC 94 ms
71,620 KB
testcase_17 AC 93 ms
71,796 KB
testcase_18 AC 91 ms
71,592 KB
testcase_19 AC 95 ms
71,772 KB
testcase_20 AC 94 ms
71,704 KB
testcase_21 AC 95 ms
71,880 KB
testcase_22 AC 98 ms
71,492 KB
testcase_23 AC 97 ms
71,780 KB
testcase_24 AC 95 ms
71,752 KB
testcase_25 AC 95 ms
71,700 KB
testcase_26 AC 96 ms
71,880 KB
testcase_27 AC 94 ms
71,652 KB
testcase_28 AC 95 ms
71,644 KB
testcase_29 AC 94 ms
71,596 KB
testcase_30 AC 95 ms
71,668 KB
testcase_31 AC 94 ms
71,760 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
    
    if tuple(l) in dic:
        loop = dic[tp]- dic[tuple(l)] + 1
        start = dic[tuple(l)]
        break
    else:
        dic[tuple(l)] = i + 1
    tp = tuple(l)
nn = n-start
nn %= loop
end = start + nn
for key in dic.keys():
    if dic[key] == end:
        print(*key)
        break
0