結果

問題 No.397 NO MORE KADOMATSU
ユーザー kimiyukikimiyuki
提出日時 2016-07-15 22:45:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 10,580 KB
実行使用メモリ 24,868 KB
平均クエリ数 936.56
最終ジャッジ日時 2023-09-24 00:13:41
合計ジャッジ時間 2,298 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
23,828 KB
testcase_01 AC 39 ms
24,276 KB
testcase_02 AC 39 ms
24,336 KB
testcase_03 AC 42 ms
23,612 KB
testcase_04 AC 39 ms
23,984 KB
testcase_05 AC 41 ms
24,036 KB
testcase_06 AC 44 ms
24,080 KB
testcase_07 AC 45 ms
24,304 KB
testcase_08 AC 41 ms
23,676 KB
testcase_09 AC 40 ms
23,476 KB
testcase_10 AC 69 ms
24,588 KB
testcase_11 AC 41 ms
23,736 KB
testcase_12 AC 49 ms
24,068 KB
testcase_13 AC 54 ms
24,868 KB
testcase_14 AC 53 ms
24,828 KB
testcase_15 AC 54 ms
24,688 KB
testcase_16 AC 39 ms
23,448 KB
testcase_17 AC 39 ms
23,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import sys
n = int(input())
a = list(map(int,input().split()))
ans = []
for i in range(n):
    for j in reversed(range(i)):
        if a[j] > a[j+1]:
            ans.append((j, j+1))
            a[j], a[j+1] = a[j+1], a[j]
print(len(ans))
for i, j in ans:
    print(i, j)
sys.stdout.flush()
dummy = input()
0