結果

問題 No.2465 Dilated Water Simulation
ユーザー gbrsofygbrsofy
提出日時 2023-11-02 18:40:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,501 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 12,092 KB
実行使用メモリ 33,684 KB
最終ジャッジ日時 2023-11-02 18:40:43
合計ジャッジ時間 23,110 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,368 KB
testcase_01 AC 30 ms
10,368 KB
testcase_02 AC 29 ms
10,368 KB
testcase_03 AC 29 ms
10,368 KB
testcase_04 AC 41 ms
10,368 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!

s = int(input())
t = input().split(" ")
u = int(input())

a = u % s
b = u // s
res = [0]*s
res_t=[0]*s
res[0]=int(t[0])
for x in range(b):
    for i in range(s):
        t_a = int(t[i])
        t_b = int(t[(i+1)%s])
            
        if t_a > t_b:
            if res[i]>=t_b:
                res[i]=res[i]-(t_b - res[(i+1)%s])
                res[(i+1)%s]=t_b
            else:
                tmp=res[i]
                res[i]=res[i]-(t_b - res[(i+1)%s])
                res[(i+1)%s]=tmp
        else:
            if t_b <= (res[i]+res[(i+1)%s]):
                res[i]=res[i]-(t_b - res[(i+1)%s])
                res[(i+1)%s]=t_b
            else:
                res[(i+1)%s]=res[(i+1)%s]+res[i]
                res[i]=0
                
        #print(res,res_t)
    if res_t == res:
        break
    res_t = res
    #print(res)
if a !=0:
    for i in range(a):
        t_a = int(t[i])
        t_b = int(t[(i+1)%s])
            
        if t_a > t_b:
            if res[i]>=t_b:
                res[i]=res[i]-(t_b - res[(i+1)%s])
                res[(i+1)%s]=t_b
            else:
                tmp=res[i]
                res[i]=res[i]-(t_b - res[(i+1)%s])
                res[(i+1)%s]=tmp
        else:
            if t_b <= (res[i]+res[(i+1)%s]):
                res[i]=res[i]-(t_b - res[(i+1)%s])
                res[(i+1)%s]=t_b
            else:
                res[(i+1)%s]=res[(i+1)%s]+res[i]
                res[i]=0
        #print(res)
print(*res)
0