結果
問題 | No.876 Range Compress Query |
ユーザー |
![]() |
提出日時 | 2024-09-09 17:58:00 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 678 bytes |
コンパイル時間 | 497 ms |
コンパイル使用メモリ | 82,448 KB |
実行使用メモリ | 90,868 KB |
最終ジャッジ日時 | 2024-09-09 17:58:06 |
合計ジャッジ時間 | 5,535 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 17 WA * 1 |
ソースコード
n,q=map(int,input().split())a=list(map(int,input().split()))B=317st1=[0]*B*Bst2=[0]*Bfor i in range(n-1):st1[i]=a[i+1]-a[i]for i in range(B):st2[i]=st1[i*B:i*B+B].count(0)for _ in range(q):t,*que,=map(int,input().split())if t==1:l,r,x=quel-=1r-=1if l-1>=0:st1[l-1]+=xy=(l-1)//Bst2[y]=st1[y*B:y*B+B].count(0)st1[r]-=xy=r//Bst2[y]=st1[y*B:y*B+B].count(0)if t==2:l,r=quel-=1r-=1r-=1a=0yl=l//Byr=r//Bif yl==yr:a+=st1[l:r+1].count(0)else:a+=st1[l:yl*B+B].count(0)a+=st1[yr*B:r+1].count(0)a+=sum(st2[yl+1:yr])print(r-l+1-a+1)