結果

問題 No.876 Range Compress Query
ユーザー tails
提出日時 2021-03-23 19:27:25
言語 cLay
(20241019-1)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 312 bytes
コンパイル時間 3,440 ms
コンパイル使用メモリ 179,800 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-07-05 15:10:05
合計ジャッジ時間 4,762 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

segtree<ll> t;
ll n,q,a[1d5];
ll b,l,r,x;

{
	rd(n,q,a(n));
	t.walloc(n,1);
	rep(i,n-1)t[i]=(a[i]=a[i+1]-a[i])!=0;
	t.build();
	rep(q){
		rd(b,l,r);
		--l; --r;
		if(b==1){
			rd(x);
			if(l>0)	t.change(l-1,l,(a[l-1]+=x)!=0);
			t.change(r,r+1,(a[r]-=x)!=0);
		}else{
			wt(1ll+(l==r?0:t.getSum(l,r)));
		}
	}
}
0