結果

問題 No.2101 [Cherry Alpha N] ずっとこの数列だったらいいのに
ユーザー tailstails
提出日時 2022-10-15 11:07:46
言語 cLay
(20240104-1)
結果
AC  
実行時間 151 ms / 6,000 ms
コード長 506 bytes
コンパイル時間 8,373 ms
コンパイル使用メモリ 224,600 KB
実行使用メモリ 31,480 KB
最終ジャッジ日時 2023-09-09 02:22:48
合計ジャッジ時間 18,558 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,356 KB
testcase_01 AC 1 ms
4,356 KB
testcase_02 AC 1 ms
4,360 KB
testcase_03 AC 68 ms
19,296 KB
testcase_04 AC 106 ms
24,180 KB
testcase_05 AC 60 ms
16,616 KB
testcase_06 AC 97 ms
23,084 KB
testcase_07 AC 108 ms
24,896 KB
testcase_08 AC 103 ms
23,916 KB
testcase_09 AC 51 ms
15,340 KB
testcase_10 AC 47 ms
14,864 KB
testcase_11 AC 76 ms
20,640 KB
testcase_12 AC 76 ms
20,664 KB
testcase_13 AC 54 ms
15,824 KB
testcase_14 AC 57 ms
17,348 KB
testcase_15 AC 121 ms
26,268 KB
testcase_16 AC 96 ms
23,488 KB
testcase_17 AC 41 ms
13,776 KB
testcase_18 AC 147 ms
31,276 KB
testcase_19 AC 147 ms
31,284 KB
testcase_20 AC 147 ms
31,468 KB
testcase_21 AC 146 ms
31,272 KB
testcase_22 AC 149 ms
31,360 KB
testcase_23 AC 149 ms
31,476 KB
testcase_24 AC 146 ms
31,284 KB
testcase_25 AC 145 ms
31,224 KB
testcase_26 AC 146 ms
31,352 KB
testcase_27 AC 146 ms
31,340 KB
testcase_28 AC 151 ms
31,232 KB
testcase_29 AC 149 ms
31,480 KB
testcase_30 AC 147 ms
31,224 KB
testcase_31 AC 149 ms
31,260 KB
testcase_32 AC 149 ms
31,236 KB
testcase_33 AC 135 ms
31,276 KB
testcase_34 AC 133 ms
31,400 KB
testcase_35 AC 131 ms
31,332 KB
testcase_36 AC 132 ms
31,272 KB
testcase_37 AC 131 ms
31,236 KB
testcase_38 AC 22 ms
19,736 KB
testcase_39 AC 56 ms
21,276 KB
testcase_40 AC 80 ms
30,876 KB
testcase_41 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@n,a[n],t[],u[],x[],y[];
rd((a,t--)(n));
rep(i,n){
	x[i]=a[i]+t[i];
}
sortA_index(n,x,y);
sortA_index(n,t,a,u);
ll@q,d[q],l[],r[],v[],w[];
rd((d,l--,r--)(q));
sortA_index(q,d,l,r,v);
fenwick<ll>f0,f1;
f0.malloc(n,1);
f1.malloc(n,1);
rep(i,n){
	f0.add(u[i],a[i]);
}
ll b=0,c=0;
rep(j,q){
	while(b<n&&t[b]<d[j]){
		f0.add(u[b],t[b]);
		f1.add(u[b],1);
		++b;
	}
	while(c<n&&x[c]<d[j]){
		f0.add(y[c],-x[c]);
		f1.add(y[c],-1);
		++c;
	}
	w[v[j]]=f0.range(l[j],r[j])-d[j]*f1.range(l[j],r[j]);
}
wtLn(w(q));
0