結果
| 問題 | No.1000 Point Add and Array Add |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-12 01:23:10 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 342 ms / 2,000 ms |
| コード長 | 560 bytes |
| 記録 | |
| コンパイル時間 | 464 ms |
| コンパイル使用メモリ | 85,212 KB |
| 実行使用メモリ | 116,432 KB |
| 最終ジャッジ日時 | 2026-05-12 01:23:23 |
| 合計ジャッジ時間 | 10,566 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
def aa(s,v):
d=1
while s<len(fen):
if s&d:
fen[s]+=v
s+=d
d<<=1
def bb(s):
res,d=0,1
while s:
if s&d:
res+=fen[s]
s-=d
d<<=1
return res
n,q=map(int,input().split())
fen=[0]*(n+2)
ans=[0]*n
x=list(map(int,input().split()))
for i in range(q):
a,b,c=input().split()
b=int(b);c=int(c)
if a=="A":
x[b-1]+=c
ans[b-1]-=bb(b)*c
else:
aa(b,1);aa(c+1,-1)
for i in range(n):
ans[i]+=bb(i+1)*x[i]
print(" ".join(map(str,ans)))