結果

問題 No.397 NO MORE KADOMATSU
ユーザー rpy3cpprpy3cpp
提出日時 2016-07-15 22:48:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 10,708 KB
実行使用メモリ 24,684 KB
平均クエリ数 936.56
最終ジャッジ日時 2023-09-24 00:14:30
合計ジャッジ時間 1,871 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
24,336 KB
testcase_01 AC 34 ms
23,676 KB
testcase_02 AC 33 ms
23,512 KB
testcase_03 AC 34 ms
24,096 KB
testcase_04 AC 32 ms
23,724 KB
testcase_05 AC 32 ms
23,664 KB
testcase_06 AC 34 ms
23,984 KB
testcase_07 AC 34 ms
23,992 KB
testcase_08 AC 40 ms
24,036 KB
testcase_09 AC 32 ms
24,360 KB
testcase_10 AC 51 ms
24,560 KB
testcase_11 AC 32 ms
24,276 KB
testcase_12 AC 37 ms
23,772 KB
testcase_13 AC 42 ms
24,548 KB
testcase_14 AC 45 ms
24,684 KB
testcase_15 AC 42 ms
24,164 KB
testcase_16 AC 32 ms
24,100 KB
testcase_17 AC 34 ms
23,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
As = list(map(int, input().split()))

def solve(N, As):
    ans = []
    for i in range(N):
        for j in range(N-1, i, -1):
            if As[j] < As[j-1]:
                As[j], As[j-1] = As[j-1], As[j]
                ans.append((j, j-1))
    return ans

ans = solve(N, As)
print(len(ans))
for u, v in ans:
    print(u, v)

dummy = input()
0