結果

問題 No.3265 地元に帰れば天才扱い!
ユーザー こめだわら
提出日時 2025-08-10 11:11:32
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 411 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 82,648 KB
実行使用メモリ 67,240 KB
最終ジャッジ日時 2025-09-06 12:31:58
合計ジャッジ時間 4,769 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 4
other RE * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))

from atcoder.segtree import *

def op(x,y):
    return x+y

STA=SegTree(op,0,A)
STS=SegTree(op,0,[0]*(N+1))

Q=int(input())
ans=0
for _ in range(Q):
    x,y,l,r=map(int,input().split())
    l-=1
    x-=1
    s=STS.prod(0,x+1)
    ans+=(y-STA.get(x))*s
    STA.set(x,y)
    ans+=STA.prod(l,r)
    STS.set(l,STS.get(l)+1)
    STS.set(r,STS.get(r)-1)
    print(ans)
0