結果

問題 No.397 NO MORE KADOMATSU
ユーザー htkbhtkb
提出日時 2018-05-28 22:13:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 10,676 KB
実行使用メモリ 24,640 KB
平均クエリ数 936.56
最終ジャッジ日時 2023-09-24 01:46:38
合計ジャッジ時間 2,060 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
24,228 KB
testcase_01 AC 34 ms
23,652 KB
testcase_02 AC 35 ms
23,444 KB
testcase_03 AC 37 ms
24,000 KB
testcase_04 AC 37 ms
23,664 KB
testcase_05 AC 38 ms
23,396 KB
testcase_06 AC 41 ms
24,036 KB
testcase_07 AC 44 ms
24,132 KB
testcase_08 AC 37 ms
23,520 KB
testcase_09 AC 35 ms
23,488 KB
testcase_10 AC 61 ms
24,640 KB
testcase_11 AC 34 ms
24,348 KB
testcase_12 AC 44 ms
24,148 KB
testcase_13 AC 49 ms
24,440 KB
testcase_14 AC 52 ms
24,204 KB
testcase_15 AC 49 ms
23,916 KB
testcase_16 AC 36 ms
23,388 KB
testcase_17 AC 38 ms
23,364 KB
権限があれば一括ダウンロードができます

ソースコード

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