結果

問題 No.397 NO MORE KADOMATSU
ユーザー akitsugu777akitsugu777
提出日時 2019-07-25 11:10:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 272 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 10,644 KB
実行使用メモリ 24,360 KB
平均クエリ数 36.83
最終ジャッジ日時 2023-09-24 02:17:34
合計ジャッジ時間 2,026 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
23,664 KB
testcase_01 AC 40 ms
24,360 KB
testcase_02 AC 37 ms
23,676 KB
testcase_03 AC 39 ms
24,000 KB
testcase_04 AC 39 ms
23,712 KB
testcase_05 AC 38 ms
24,000 KB
testcase_06 AC 39 ms
23,676 KB
testcase_07 AC 39 ms
24,264 KB
testcase_08 AC 39 ms
23,484 KB
testcase_09 AC 38 ms
23,552 KB
testcase_10 AC 38 ms
24,000 KB
testcase_11 AC 38 ms
23,536 KB
testcase_12 AC 39 ms
23,444 KB
testcase_13 AC 39 ms
23,988 KB
testcase_14 AC 40 ms
23,560 KB
testcase_15 AC 39 ms
23,560 KB
testcase_16 AC 38 ms
24,040 KB
testcase_17 AC 38 ms
23,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))

b = sorted(a)
c = 0
l = []
for i in range(n):
    while a[i] != b[i]:
        d = a[i:].index(b[i])
        l.append([i, i+d])
        a[i], a[i+d] = a[i+d], a[i]
        c += 1

print(c)
for i, j in l:
    print(i, j)
0