結果
問題 | No.397 NO MORE KADOMATSU |
ユーザー | はむ吉🐹 |
提出日時 | 2016-07-15 22:55:47 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 75 ms / 2,000 ms |
コード長 | 529 bytes |
コンパイル時間 | 290 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 28,120 KB |
平均クエリ数 | 936.56 |
最終ジャッジ日時 | 2024-07-17 00:05:31 |
合計ジャッジ時間 | 2,236 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#!/usr/bin/env python3 import sys def main(): n = int(input()) xs = list(map(int, input().split())) m = 0 ops = [] flag = True while flag: flag = False for j in range(1, n)[::-1]: if xs[j] < xs[j - 1]: xs[j], xs[j - 1] = xs[j - 1], xs[j] ops.append((j, j - 1)) m += 1 flag = True print(m) for op in ops: print(*op) sys.stdout.flush() _ = input() if __name__ == '__main__': main()