結果

問題 No.876 Range Compress Query
ユーザー tailstails
提出日時 2019-09-06 22:54:47
言語 cLay
(20231016-1)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 303 bytes
コンパイル時間 4,273 ms
コンパイル使用メモリ 181,700 KB
実行使用メモリ 15,092 KB
最終ジャッジ日時 2023-09-19 00:25:49
合計ジャッジ時間 7,245 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,448 KB
testcase_01 WA -
testcase_02 AC 2 ms
5,616 KB
testcase_03 WA -
testcase_04 AC 2 ms
5,432 KB
testcase_05 AC 2 ms
5,360 KB
testcase_06 WA -
testcase_07 AC 2 ms
5,468 KB
testcase_08 AC 2 ms
5,364 KB
testcase_09 AC 2 ms
5,476 KB
testcase_10 AC 2 ms
5,456 KB
testcase_11 AC 64 ms
14,944 KB
testcase_12 WA -
testcase_13 AC 57 ms
14,924 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 64 ms
15,084 KB
testcase_17 AC 62 ms
15,092 KB
testcase_18 AC 68 ms
15,080 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+t.getSum(l,r));
		}
	}
}
0