結果

問題 No.2665 Minimize Inversions of Deque
ユーザー 👑 p-adicp-adic
提出日時 2023-12-30 09:53:37
言語 cLay
(20240104-1)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 252 bytes
コンパイル時間 4,087 ms
コンパイル使用メモリ 177,104 KB
実行使用メモリ 16,832 KB
最終ジャッジ日時 2024-01-05 15:03:05
合計ジャッジ時間 5,631 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,488 KB
testcase_01 AC 14 ms
10,304 KB
testcase_02 AC 14 ms
10,176 KB
testcase_03 AC 14 ms
10,304 KB
testcase_04 AC 14 ms
10,304 KB
testcase_05 AC 14 ms
10,304 KB
testcase_06 AC 14 ms
10,304 KB
testcase_07 AC 14 ms
10,304 KB
testcase_08 AC 15 ms
10,304 KB
testcase_09 AC 14 ms
10,304 KB
testcase_10 AC 14 ms
10,304 KB
testcase_11 AC 15 ms
10,304 KB
testcase_12 AC 14 ms
10,304 KB
testcase_13 AC 14 ms
10,304 KB
testcase_14 AC 14 ms
10,304 KB
testcase_15 AC 15 ms
10,304 KB
testcase_16 AC 14 ms
10,304 KB
testcase_17 AC 14 ms
10,304 KB
testcase_18 AC 14 ms
10,304 KB
testcase_19 AC 4 ms
7,744 KB
testcase_20 AC 3 ms
7,616 KB
testcase_21 AC 3 ms
7,488 KB
testcase_22 AC 3 ms
7,616 KB
testcase_23 AC 4 ms
7,616 KB
testcase_24 AC 3 ms
7,616 KB
testcase_25 AC 3 ms
7,616 KB
testcase_26 AC 3 ms
7,616 KB
testcase_27 AC 3 ms
7,616 KB
testcase_28 AC 3 ms
7,616 KB
testcase_29 AC 3 ms
7,616 KB
testcase_30 AC 37 ms
15,936 KB
testcase_31 AC 32 ms
12,608 KB
testcase_32 AC 33 ms
13,120 KB
testcase_33 AC 36 ms
15,040 KB
testcase_34 AC 32 ms
11,968 KB
testcase_35 AC 30 ms
16,832 KB
testcase_36 AC 31 ms
16,832 KB
testcase_37 AC 32 ms
12,352 KB
testcase_38 AC 34 ms
14,528 KB
testcase_39 AC 38 ms
16,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@T;rep(T){ll@N,a=0;list<ll>A;fenwick<ll>t;t.malloc(N+1,1);rep(i,N){ll@P,c=t.range(0,P);if(c>i-c||A.empty()||i==2c&&A.front()<P)a+=i-c,A.push_back(P);else a+=c,A.push_front(P);t.add(P,1);}wt(a);auto j=A.begin(),e=A.end();while(j!=e)wtSp(*j++);wt("");}
0