結果

問題 No.3164 [Chery 7th Tune B] La vie en rose
ユーザー 👑 p-adic
提出日時 2024-07-21 09:55:49
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 269 bytes
コンパイル時間 482 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 43,860 KB
最終ジャッジ日時 2025-05-30 21:02:43
合計ジャッジ時間 53,993 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 TLE * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

I,R=input,range
J=lambda:map(int,I().split())
N,*_=J()
A=list(J())
S=[0]*(N+2)
i=j=s=0
while i<N:
	if A[i]:
		while j<N and A[j]:s+=A[j];j+=1
		for k in R(i,j):S[k+1]=s
	else:j=i+1;s=0
	i=j
for _ in R(int(I())):X,B=J();print(S[X]-A[X-1]+B if A[X-1]else S[X-1]+B+S[X+1])
0