結果

問題 No.1604 Swap Sort:ONE
ユーザー convexineqconvexineq
提出日時 2021-07-16 21:34:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 208 bytes
コンパイル時間 1,024 ms
コンパイル使用メモリ 86,864 KB
実行使用メモリ 76,876 KB
最終ジャッジ日時 2023-09-20 13:14:41
合計ジャッジ時間 4,452 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,380 KB
testcase_01 AC 74 ms
71,220 KB
testcase_02 AC 75 ms
71,448 KB
testcase_03 AC 74 ms
71,460 KB
testcase_04 AC 74 ms
71,564 KB
testcase_05 AC 96 ms
76,460 KB
testcase_06 AC 94 ms
76,772 KB
testcase_07 AC 117 ms
76,744 KB
testcase_08 AC 121 ms
76,876 KB
testcase_09 AC 115 ms
76,428 KB
testcase_10 AC 116 ms
76,496 KB
testcase_11 AC 114 ms
76,808 KB
testcase_12 AC 120 ms
76,496 KB
testcase_13 AC 115 ms
76,496 KB
testcase_14 AC 112 ms
76,804 KB
testcase_15 AC 115 ms
76,436 KB
testcase_16 AC 114 ms
76,704 KB
testcase_17 AC 91 ms
76,840 KB
testcase_18 AC 90 ms
76,624 KB
testcase_19 AC 111 ms
76,644 KB
testcase_20 AC 90 ms
76,792 KB
testcase_21 AC 110 ms
76,828 KB
testcase_22 AC 103 ms
76,808 KB
testcase_23 AC 82 ms
76,224 KB
testcase_24 AC 79 ms
76,456 KB
testcase_25 AC 112 ms
76,764 KB
testcase_26 AC 97 ms
76,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
*p, = map(lambda x: int(x)-1,input().split())
pos = [0]*n
for i,pi in enumerate(p):
    pos[pi] = i
ans = 0
for i in range(n):
    for j in range(i):
        ans += pos[i] < pos[j]
print(ans)
0