結果

問題 No.1300 Sum of Inversions
ユーザー tailstails
提出日時 2020-11-30 10:59:16
言語 cLay
(20240104-1)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 407 bytes
コンパイル時間 6,365 ms
コンパイル使用メモリ 216,148 KB
実行使用メモリ 16,188 KB
最終ジャッジ日時 2023-09-19 01:53:46
合計ジャッジ時間 12,150 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,776 KB
testcase_01 AC 3 ms
7,700 KB
testcase_02 AC 3 ms
7,500 KB
testcase_03 AC 43 ms
14,084 KB
testcase_04 AC 40 ms
13,788 KB
testcase_05 AC 33 ms
13,600 KB
testcase_06 AC 49 ms
14,040 KB
testcase_07 AC 45 ms
13,920 KB
testcase_08 AC 49 ms
14,116 KB
testcase_09 AC 49 ms
14,040 KB
testcase_10 AC 27 ms
13,412 KB
testcase_11 AC 28 ms
13,464 KB
testcase_12 AC 41 ms
14,072 KB
testcase_13 AC 39 ms
13,824 KB
testcase_14 AC 55 ms
16,188 KB
testcase_15 AC 48 ms
14,168 KB
testcase_16 AC 43 ms
13,896 KB
testcase_17 AC 25 ms
11,400 KB
testcase_18 AC 31 ms
13,632 KB
testcase_19 AC 37 ms
13,744 KB
testcase_20 AC 37 ms
13,756 KB
testcase_21 AC 37 ms
13,684 KB
testcase_22 AC 33 ms
13,648 KB
testcase_23 AC 46 ms
14,036 KB
testcase_24 AC 33 ms
13,820 KB
testcase_25 AC 29 ms
13,552 KB
testcase_26 AC 28 ms
13,584 KB
testcase_27 AC 32 ms
13,576 KB
testcase_28 AC 51 ms
14,072 KB
testcase_29 AC 35 ms
13,880 KB
testcase_30 AC 48 ms
14,224 KB
testcase_31 AC 33 ms
13,576 KB
testcase_32 AC 34 ms
13,620 KB
testcase_33 AC 12 ms
11,564 KB
testcase_34 AC 16 ms
12,116 KB
testcase_35 AC 31 ms
14,176 KB
testcase_36 AC 32 ms
14,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define MD 998244353

struct S {
	Mint a,b,c,d;
	S(int){}
	S(Mint a,Mint b,Mint c,Mint d):a(a),b(b),c(c),d(d){}
	void operator+=(S const& s){
		a+=s.a;
		b+=s.b;
		c+=s.c;
		d+=s.d;
	}
};

int a[2d5],c[2d5];
{
	fenwick<S>f;
	f.walloc(2d5,1);
	Mint sum=0;
	ll @n;
	rd(a(n));
	coordcomp(n,a,c);
	rep(i,n){
		S s=f.get(n-c[i]-1);
		sum+=a[i]*s.b+s.d;
		f.add(n-c[i],S(1,s.a,a[i],a[i]*s.a+s.c));
	}
	wt(sum);
}
0