結果

問題 No.2465 Dilated Water Simulation
ユーザー gbrsofy
提出日時 2023-11-02 18:40:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 1,501 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 34,624 KB
最終ジャッジ日時 2024-09-25 18:16:53
合計ジャッジ時間 24,927 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 WA * 23
権限があれば一括ダウンロードができます

ソースコード

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