結果
| 問題 |
No.876 Range Compress Query
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2021-03-23 20:09:40 |
| 言語 | cLay (20241019-1) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 2,000 ms |
| コード長 | 364 bytes |
| コンパイル時間 | 2,904 ms |
| コンパイル使用メモリ | 179,260 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-05 15:09:55 |
| 合計ジャッジ時間 | 4,173 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 18 |
ソースコード
{
fenwick<int>f;
int@n,@q;VI@a(n);
f.walloc(n,1);
rep(i,n-1)f.add(i,(a[i]-=a[i+1])!=0);
rep(q){
int@b,@l,@r;
--l; --r;
if(b==1){
int@x;
int t;
if(--l>=0){
t=a[l]!=0;
t=((a[l]-=x)!=0)-t;
if(t) f.add(l,t);
}
{
t=a[r]!=0;
t=((a[r]+=x)!=0)-t;
if(t) f.add(r,t);
}
}else{
wt(1+(l==r?0:f.range(l,r-1)));
}
}
}
tails