結果

問題 No.876 Range Compress Query
ユーザー tailstails
提出日時 2021-03-23 19:27:25
言語 cLay
(20240104-1)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 312 bytes
コンパイル時間 3,731 ms
コンパイル使用メモリ 180,816 KB
実行使用メモリ 15,188 KB
最終ジャッジ日時 2023-09-19 02:18:44
合計ジャッジ時間 5,687 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,396 KB
testcase_01 AC 2 ms
5,436 KB
testcase_02 AC 2 ms
5,372 KB
testcase_03 AC 2 ms
5,488 KB
testcase_04 AC 2 ms
5,412 KB
testcase_05 AC 2 ms
5,440 KB
testcase_06 AC 2 ms
5,556 KB
testcase_07 AC 2 ms
5,452 KB
testcase_08 AC 2 ms
5,380 KB
testcase_09 AC 2 ms
5,396 KB
testcase_10 AC 2 ms
5,456 KB
testcase_11 AC 89 ms
15,064 KB
testcase_12 AC 75 ms
14,880 KB
testcase_13 AC 74 ms
15,112 KB
testcase_14 AC 89 ms
15,076 KB
testcase_15 AC 61 ms
14,924 KB
testcase_16 AC 87 ms
15,092 KB
testcase_17 AC 87 ms
15,188 KB
testcase_18 AC 90 ms
15,108 KB
権限があれば一括ダウンロードができます

ソースコード

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