結果

問題 No.1300 Sum of Inversions
ユーザー tailstails
提出日時 2020-11-27 23:00:07
言語 cLay
(20240104-1)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 6,304 ms
コンパイル使用メモリ 216,608 KB
実行使用メモリ 16,216 KB
最終ジャッジ日時 2023-09-19 01:53:57
合計ジャッジ時間 9,953 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,508 KB
testcase_01 AC 3 ms
7,672 KB
testcase_02 AC 3 ms
7,520 KB
testcase_03 AC 60 ms
13,900 KB
testcase_04 AC 62 ms
13,800 KB
testcase_05 AC 49 ms
13,644 KB
testcase_06 AC 77 ms
13,984 KB
testcase_07 AC 70 ms
14,112 KB
testcase_08 AC 80 ms
14,112 KB
testcase_09 AC 80 ms
14,104 KB
testcase_10 AC 40 ms
13,680 KB
testcase_11 AC 39 ms
13,428 KB
testcase_12 AC 61 ms
13,864 KB
testcase_13 AC 58 ms
13,836 KB
testcase_14 AC 91 ms
16,216 KB
testcase_15 AC 72 ms
14,188 KB
testcase_16 AC 65 ms
13,932 KB
testcase_17 AC 37 ms
11,304 KB
testcase_18 AC 45 ms
13,576 KB
testcase_19 AC 52 ms
13,672 KB
testcase_20 AC 52 ms
13,748 KB
testcase_21 AC 53 ms
13,696 KB
testcase_22 AC 48 ms
13,596 KB
testcase_23 AC 72 ms
13,976 KB
testcase_24 AC 48 ms
13,792 KB
testcase_25 AC 43 ms
13,488 KB
testcase_26 AC 43 ms
13,464 KB
testcase_27 AC 45 ms
13,588 KB
testcase_28 AC 82 ms
14,080 KB
testcase_29 AC 54 ms
13,688 KB
testcase_30 AC 81 ms
14,232 KB
testcase_31 AC 48 ms
13,652 KB
testcase_32 AC 51 ms
13,704 KB
testcase_33 AC 53 ms
11,516 KB
testcase_34 AC 55 ms
12,140 KB
testcase_35 AC 53 ms
14,236 KB
testcase_36 AC 55 ms
14,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define MD 998244353
int a[2d5],c[2d5];
{
	fenwick<Mint>f1,f2,g1,g2;
	f1.walloc(2d5,1);
	f2.walloc(2d5,1);
	g1.walloc(2d5,1);
	g2.walloc(2d5,1);
	Mint sum=0;
	ll @n;
	rd(a(n));
	coordcomp(n,a,c);
	rep(i,n){
		sum+=a[i]*g2.range(c[i]+1,2d5-1)+f2.range(c[i]+1,2d5-1);
		g2.add(c[i],g1.range(c[i]+1,2d5-1));
		g1.add(c[i],1);
		f2.add(c[i],a[i]*g1.range(c[i]+1,2d5-1)+f1.range(c[i]+1,2d5-1));
		f1.add(c[i],a[i]);
	}
	wt(sum);
}
0