結果

問題 No.1935 Water Simulation
ユーザー roarisroaris
提出日時 2022-05-14 18:30:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 728 bytes
コンパイル時間 421 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 75,204 KB
最終ジャッジ日時 2023-09-30 10:33:02
合計ジャッジ時間 4,286 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,488 KB
testcase_01 AC 77 ms
75,204 KB
testcase_02 AC 72 ms
71,372 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 71 ms
71,180 KB
testcase_06 AC 72 ms
71,252 KB
testcase_07 AC 71 ms
71,476 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 71 ms
71,532 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 73 ms
71,240 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 74 ms
71,368 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 74 ms
71,528 KB
testcase_24 WA -
testcase_25 AC 75 ms
71,396 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 73 ms
71,376 KB
testcase_30 AC 73 ms
71,200 KB
testcase_31 AC 72 ms
71,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

V1, V2, V3, V4, N = map(int, input().split())
V = [V1, V2, V3, V4]
now = [V1, 0, 0, 0]
s = {tuple(now)}

for i in range(N):
    if now[i%4]+now[(i+1)%4]<=V[(i+1)%4]:
        now[i%4], now[(i+1)%4] = 0, now[i%4]+now[(i+1)%4]
    else:
        now[i%4], now[(i+1)%4] = now[i%4]-V[(i+1)%4]+now[(i+1)%4], V[(i+1)%4]
    
    if i%4==3:
        if tuple(now) in s:
            for j in range(N%((i+1)//4)):
                if now[j%4]+now[(j+1)%4]<=V[(j+1)%4]:
                    now[j%4], now[(j+1)%4] = 0, now[j%4]+now[(j+1)%4]
                else:
                    now[j%4], now[(j+1)%4] = now[j%4]-V[(j+1)%4]+now[(j+1)%4], V[(j+1)%4]
            
            exit(print(*now))
        
        s.add(tuple(now))

print(*now)
0