結果

問題 No.2665 Minimize Inversions of Deque
ユーザー 👑 p-adicp-adic
提出日時 2023-12-30 13:31:02
言語 cLay
(20240104-1)
結果
TLE  
実行時間 -
コード長 388 bytes
コンパイル時間 2,841 ms
コンパイル使用メモリ 179,024 KB
実行使用メモリ 23,104 KB
最終ジャッジ日時 2024-01-05 15:03:32
合計ジャッジ時間 8,534 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
14,292 KB
testcase_01 AC 20 ms
10,304 KB
testcase_02 AC 20 ms
10,176 KB
testcase_03 AC 20 ms
10,304 KB
testcase_04 AC 22 ms
10,304 KB
testcase_05 AC 20 ms
10,304 KB
testcase_06 AC 21 ms
10,304 KB
testcase_07 AC 20 ms
10,304 KB
testcase_08 AC 20 ms
10,304 KB
testcase_09 AC 19 ms
10,304 KB
testcase_10 AC 17 ms
10,304 KB
testcase_11 AC 18 ms
10,304 KB
testcase_12 AC 19 ms
10,304 KB
testcase_13 AC 21 ms
10,304 KB
testcase_14 AC 20 ms
10,304 KB
testcase_15 AC 21 ms
10,304 KB
testcase_16 AC 20 ms
10,304 KB
testcase_17 AC 23 ms
10,304 KB
testcase_18 AC 21 ms
10,304 KB
testcase_19 AC 5 ms
7,744 KB
testcase_20 AC 3 ms
7,616 KB
testcase_21 AC 3 ms
7,616 KB
testcase_22 AC 3 ms
7,616 KB
testcase_23 AC 4 ms
7,616 KB
testcase_24 AC 4 ms
7,616 KB
testcase_25 AC 4 ms
7,616 KB
testcase_26 AC 3 ms
7,744 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 40 ms
15,936 KB
testcase_31 AC 35 ms
12,608 KB
testcase_32 AC 55 ms
18,112 KB
testcase_33 AC 59 ms
23,104 KB
testcase_34 AC 48 ms
15,424 KB
testcase_35 TLE -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

//誤解法(O(N^2)愚直解)チェック
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())a+=i-c,A.push_back(P);else if(c<i-c) a+=c,A.push_front(P);else{auto B=A,C=A;B.push_front(P),C.push_back(P);if(B<C)a+=c,A.push_front(P);else a+=i-c,A.push_back(P);}t.add(P,1);}wt(a);auto j=A.begin(),e=A.end();while(j!=e)wtSp(*j++);wt("");}
0