結果
問題 |
No.1375 Divide and Update
|
ユーザー |
![]() |
提出日時 | 2021-02-05 22:13:52 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,011 bytes |
コンパイル時間 | 202 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 134,656 KB |
最終ジャッジ日時 | 2024-07-02 12:42:30 |
合計ジャッジ時間 | 3,860 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 WA * 7 |
ソースコード
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N,X,Y = MI() A = LI() SA = sum(A) S = [X-a for a in A] T = [Y-a for a in A] U = [S[0]] x = S[0] y = 0 for i in range(1,N-1): s = S[i] if x+y >= 0 and y+s > 0: x += y+s y = 0 elif x < s: x = s y = 0 else: y += s U.append(x) T.reverse() V = [T[0]] x = T[0] y = 0 for i in range(1,N-1): t = T[i] if x+y >= 0 and y+t > 0: x += y+t y = 0 elif x < t: x = t y = 0 else: y += t V.append(x) for i in range(1,N-1): print(SA+U[i-1]+V[N-2-i])