結果

問題 No.397 NO MORE KADOMATSU
ユーザー maspymaspy
提出日時 2020-02-02 12:34:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 449 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 45,960 KB
平均クエリ数 2.00
最終ジャッジ日時 2023-09-23 19:34:08
合計ジャッジ時間 4,729 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 347 ms
45,052 KB
testcase_01 WA -
testcase_02 AC 166 ms
45,500 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 167 ms
45,944 KB
testcase_10 WA -
testcase_11 AC 160 ms
45,264 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 165 ms
45,232 KB
testcase_17 AC 161 ms
45,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.buffer.readline

import numpy as np

N = int(readline())
A = np.fromstring(readline(), np.int64, sep=' ')

answer = []

def swap_sort(A,ind):
    if ind == 1:
        return
    n = A[:ind].argmax()
    if n == ind-1:
        swap_sort(A,ind-1)
        return
    answer.append((n,ind-1))
    A[n], A[ind-1] = A[ind-1], A[n]
    swap_sort(A,ind-1)

swap_sort(A,3)

print(len(answer))
for i,j in answer:
    print(i,j)
0