結果

問題 No.397 NO MORE KADOMATSU
ユーザー htkbhtkb
提出日時 2018-05-28 22:13:10
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 27,864 KB
平均クエリ数 936.56
最終ジャッジ日時 2024-07-17 01:44:34
合計ジャッジ時間 2,887 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
a = list(map(int, input().split()))
query = []
append = query.append
flag = True

while flag:
    flag = False

    for i in range(N-1):
        if a[i] > a[i+1]:
            a[i], a[i+1] = a[i+1], a[i]
            append((i, i+1))
            flag = True

print(len(query))
for q in query:
    print(" ".join(map(str, q)))
input()
0