結果

問題 No.1935 Water Simulation
ユーザー misonikomipanmisonikomipan
提出日時 2022-05-13 22:10:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,522 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 10,936 KB
実行使用メモリ 13,652 KB
最終ジャッジ日時 2023-09-29 07:31:09
合計ジャッジ時間 3,837 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 50 ms
13,504 KB
testcase_05 AC 51 ms
13,532 KB
testcase_06 AC 50 ms
13,472 KB
testcase_07 AC 50 ms
13,320 KB
testcase_08 AC 51 ms
13,632 KB
testcase_09 AC 51 ms
13,336 KB
testcase_10 AC 51 ms
13,504 KB
testcase_11 AC 51 ms
13,308 KB
testcase_12 AC 50 ms
13,384 KB
testcase_13 AC 51 ms
13,304 KB
testcase_14 AC 51 ms
13,376 KB
testcase_15 AC 50 ms
13,384 KB
testcase_16 AC 50 ms
13,320 KB
testcase_17 AC 51 ms
13,380 KB
testcase_18 AC 51 ms
13,472 KB
testcase_19 AC 51 ms
13,632 KB
testcase_20 AC 51 ms
13,304 KB
testcase_21 AC 51 ms
13,292 KB
testcase_22 AC 51 ms
13,336 KB
testcase_23 AC 52 ms
13,328 KB
testcase_24 AC 51 ms
13,472 KB
testcase_25 AC 51 ms
13,312 KB
testcase_26 AC 51 ms
13,328 KB
testcase_27 AC 51 ms
13,320 KB
testcase_28 AC 51 ms
13,652 KB
testcase_29 AC 52 ms
13,332 KB
testcase_30 AC 51 ms
13,468 KB
testcase_31 AC 51 ms
13,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import nntplib
import sys
import math
import heapq
from collections import deque, Counter, defaultdict
from sys import stdin



INF = 10 ** 7
int1 = lambda x: int(x) - 1
stinput = lambda: stdin.readline()[:-1]
ii = lambda: int(stinput())  # int input
mi = lambda: map(int, stdin.readline().split())  # map input (int)
li = lambda: list(mi())  # list input (int)
mi1 = lambda: map(int1, stdin.readline().split())  # map input (int)-1
li1 = lambda: list(mi1())  # list input (int)-1
mis = lambda: map(str, stdin.readline().split())  # map input (string)
lis = lambda: list(mis())  # list input (string)


*V, N = mi()

nV = [V[i] if not(i) else 0 for i in range(4)]
d = {(V[0], 0, 0, 0): 0}
d2 = {0: (V[0], 0, 0, 0)}
for n in range(N):
    pV = [nV[i] for i in range(4)]
    if n % 4 == 0:
        nV[1] = min(V[1], pV[1] + pV[0])
        nV[0] = pV[0] - (nV[1] - pV[1])
    elif n % 4 == 1:
        nV[2] = min(V[2], pV[2] + pV[1])
        nV[1] = pV[1] - (nV[2] - pV[2])
    elif n % 4 == 2:
        nV[3] = min(V[3], pV[3] + pV[2])
        nV[2] = pV[2] - (nV[3] - pV[3])
    else:
        nV[0] = min(V[0], pV[0] + pV[3])
        nV[3] = pV[3] - (nV[0] - pV[0])
    tnV = tuple(nV)
    if tnV in d:
        d[(N, N, N, N)] = n + 1
        d2[n + 1] = tnV
        roopStart = d[tnV]
        roopEnd = n + 1
        a = nV
        break
    else: 
        d[tnV] = n + 1
        d2[n + 1] = tnV
    if n == N - 1: 
        print(*nV)
        exit()
ind = roopStart + (N - roopStart) % (roopEnd - roopStart)
print(*d2[ind])
0