結果

問題 No.1604 Swap Sort:ONE
ユーザー hir355hir355
提出日時 2021-07-16 21:22:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 216 bytes
コンパイル時間 935 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 76,888 KB
最終ジャッジ日時 2023-09-20 12:54:40
合計ジャッジ時間 4,556 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,312 KB
testcase_01 AC 70 ms
71,312 KB
testcase_02 AC 72 ms
71,316 KB
testcase_03 AC 73 ms
71,328 KB
testcase_04 AC 73 ms
71,292 KB
testcase_05 AC 95 ms
76,692 KB
testcase_06 AC 96 ms
76,428 KB
testcase_07 AC 119 ms
76,616 KB
testcase_08 AC 115 ms
76,524 KB
testcase_09 AC 117 ms
76,692 KB
testcase_10 AC 118 ms
76,488 KB
testcase_11 AC 116 ms
76,656 KB
testcase_12 AC 118 ms
76,448 KB
testcase_13 AC 116 ms
76,888 KB
testcase_14 AC 115 ms
76,652 KB
testcase_15 AC 117 ms
76,396 KB
testcase_16 AC 116 ms
76,396 KB
testcase_17 AC 93 ms
76,444 KB
testcase_18 AC 93 ms
76,888 KB
testcase_19 AC 113 ms
76,692 KB
testcase_20 AC 93 ms
76,632 KB
testcase_21 AC 113 ms
76,888 KB
testcase_22 AC 105 ms
76,620 KB
testcase_23 AC 83 ms
76,308 KB
testcase_24 AC 82 ms
76,452 KB
testcase_25 AC 115 ms
76,728 KB
testcase_26 AC 98 ms
76,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
p = list(map(int, input().split()))
q = [0] * n
for i in range(n):
    q[p[i] - 1] = i
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        if q[i] > q[j]:
            ans += 1
print(ans)
0