結果
| 問題 |
No.3164 [Chery 7th Tune B] La vie en rose
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-29 10:37:45 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 557 bytes |
| コンパイル時間 | 417 ms |
| コンパイル使用メモリ | 82,848 KB |
| 実行使用メモリ | 134,472 KB |
| 最終ジャッジ日時 | 2025-06-29 10:38:14 |
| 合計ジャッジ時間 | 28,453 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 RE * 11 |
ソースコード
N = int(input())
A = [0]+list(map(int,input().split()))
B = [0]*(N+1)
i = 0
flag = 0
cnt = 0
while i<N+1:
if A[i]==0 and flag>0:
for j in range(flag,i):
B[j] = cnt
cnt = 0
flag = 0
elif A[i]>0 and flag==0:
flag = i
cnt += A[i]
elif A[i]>0 and flag>0:
cnt += A[i]
i += 1
if flag:
for j in range(flag,N+1):
B[j] = cnt
Q = int(input())
for _ in range(Q):
x,b = map(int,input().split())
if B[x]>0:
print(B[x]+b-A[x])
else:
print(b+B[x-1]+B[x+1])