結果

問題 No.877 Range ReLU Query
ユーザー tailstails
提出日時 2019-09-07 23:24:58
言語 cLay
(20240104-1)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 355 bytes
コンパイル時間 7,320 ms
コンパイル使用メモリ 218,756 KB
実行使用メモリ 36,460 KB
最終ジャッジ日時 2024-04-25 22:13:12
合計ジャッジ時間 10,243 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
11,716 KB
testcase_01 AC 4 ms
11,860 KB
testcase_02 AC 3 ms
11,736 KB
testcase_03 AC 3 ms
11,608 KB
testcase_04 AC 3 ms
13,772 KB
testcase_05 AC 3 ms
11,728 KB
testcase_06 AC 2 ms
11,724 KB
testcase_07 AC 3 ms
11,724 KB
testcase_08 AC 4 ms
11,868 KB
testcase_09 AC 4 ms
11,848 KB
testcase_10 AC 3 ms
11,736 KB
testcase_11 AC 159 ms
33,996 KB
testcase_12 AC 143 ms
34,416 KB
testcase_13 AC 108 ms
26,368 KB
testcase_14 AC 109 ms
26,220 KB
testcase_15 AC 182 ms
34,048 KB
testcase_16 AC 174 ms
33,872 KB
testcase_17 AC 185 ms
33,872 KB
testcase_18 AC 190 ms
36,460 KB
testcase_19 AC 179 ms
34,512 KB
testcase_20 AC 184 ms
34,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

segtree<ll> t,c;
ll n,q,a[2d5],l[2d5],r[2d5],j[2d5],z[1d5];
{
	rd(n,q,((a+q))(n),(a,l,r,a)(q));
	rep(i,q)j[i]=i;
	rep(i,n)j[i+q]=i;
	t.walloc(n,1);
	c.walloc(n,1);
	sortA(n+=q,a,l,r,j);
	for(;n--;){
		if(l[n]){
			z[j[n]]=t.getSum(l[n]-1,r[n])-c.getSum(l[n]-1,r[n])*a[n];
		}else{
			t.add(j[n],j[n]+1,a[n]);
			c.add(j[n],j[n]+1,1);
		}
	}
	wtLn(z(q));
}
0