結果

問題 No.1935 Water Simulation
ユーザー pitPpitP
提出日時 2022-05-13 22:42:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 772 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 10,860 KB
実行使用メモリ 8,356 KB
最終ジャッジ日時 2023-09-29 10:02:40
合計ジャッジ時間 2,133 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,192 KB
testcase_01 AC 17 ms
8,292 KB
testcase_02 AC 16 ms
8,284 KB
testcase_03 AC 17 ms
8,212 KB
testcase_04 AC 16 ms
8,196 KB
testcase_05 AC 17 ms
8,280 KB
testcase_06 AC 17 ms
8,208 KB
testcase_07 AC 16 ms
8,344 KB
testcase_08 AC 16 ms
8,324 KB
testcase_09 AC 17 ms
8,344 KB
testcase_10 AC 16 ms
8,192 KB
testcase_11 AC 16 ms
8,340 KB
testcase_12 AC 17 ms
8,344 KB
testcase_13 AC 18 ms
8,200 KB
testcase_14 AC 17 ms
8,192 KB
testcase_15 AC 17 ms
8,192 KB
testcase_16 AC 17 ms
8,296 KB
testcase_17 AC 16 ms
8,356 KB
testcase_18 AC 17 ms
8,296 KB
testcase_19 AC 17 ms
8,132 KB
testcase_20 AC 16 ms
8,184 KB
testcase_21 AC 17 ms
8,192 KB
testcase_22 AC 17 ms
8,296 KB
testcase_23 AC 18 ms
8,208 KB
testcase_24 AC 17 ms
8,284 KB
testcase_25 AC 17 ms
8,248 KB
testcase_26 AC 17 ms
8,268 KB
testcase_27 AC 18 ms
8,280 KB
testcase_28 AC 17 ms
8,292 KB
testcase_29 AC 17 ms
8,264 KB
testcase_30 AC 17 ms
8,332 KB
testcase_31 AC 16 ms
8,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

lst = list(map(int,input().split()))
v_max = lst[:-1]
now = [0]*4
now[0] = v_max[0]
n = lst[-1]

def solve(tmp):
    res = [[0]*4 for _ in range(5)]
    res[0] = tmp
    for i in range(4):
        res[i+1] = res[i][:]
        a = res[i][i]
        b = res[i][(i+1)%4]
        if a + b <= v_max[(i+1)%4]:
            res[i+1][(i+1)%4] = a + b
            res[i+1][i] = 0
        else:
            res[i+1][(i+1)%4] = v_max[(i+1)%4]
            res[i+1][i] = a + b - v_max[(i+1)%4]
    return res[1:]

def answer(n,now):
    n %= 4
    print(*now[n-1])
    exit()

while n:
    new_mat = solve(now)
    new = new_mat[-1]
    if 1 <= n <= 4:
        print(*new_mat[n-1])
        exit()
    elif now == new:
        answer(n,new_mat)
    else:
        n -= 4
        now = new
0