結果

問題 No.2065 Sum of Min
ユーザー tailstails
提出日時 2022-09-02 23:05:56
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 328 bytes
コンパイル時間 6,578 ms
コンパイル使用メモリ 224,248 KB
実行使用メモリ 17,636 KB
最終ジャッジ日時 2024-04-27 22:45:34
合計ジャッジ時間 8,309 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 23 ms
14,684 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@n,@q,@a[n],b[],l[q],r[],x[],z[];
rd((l,r,x)(q));
sortA_index(n,a,b);
fenwick<ll>f,g;
f.malloc(n,1);
g.malloc(n,1);
rep(j,n){
	f.add(b[j],a[j]);
}
rsortA(q,x,l,r);
ll c=n;
rep(i,q){
	while(c&&a[c-1]>x[i]){
		--c;
		f.add(b[c],-a[c]);
		g.add(b[c],1);
	}
	z[i]=f.range(l[i]-1,r[i]-1)+g.range(l[i]-1,r[i]-1)*x[i];
}
wtLn(z(q));
0