結果

問題 No.397 NO MORE KADOMATSU
ユーザー TawaraTawara
提出日時 2016-07-20 21:22:57
言語 Python2
(2.7.18)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 267 bytes
コンパイル時間 486 ms
コンパイル使用メモリ 6,660 KB
実行使用メモリ 24,300 KB
平均クエリ数 936.56
最終ジャッジ日時 2023-09-24 00:23:19
合計ジャッジ時間 2,197 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
23,532 KB
testcase_01 AC 30 ms
23,988 KB
testcase_02 AC 30 ms
23,604 KB
testcase_03 AC 33 ms
23,364 KB
testcase_04 AC 28 ms
23,988 KB
testcase_05 AC 29 ms
23,988 KB
testcase_06 AC 31 ms
23,316 KB
testcase_07 AC 32 ms
23,628 KB
testcase_08 AC 28 ms
23,988 KB
testcase_09 AC 28 ms
23,364 KB
testcase_10 AC 48 ms
24,264 KB
testcase_11 AC 29 ms
23,472 KB
testcase_12 AC 35 ms
23,364 KB
testcase_13 AC 44 ms
23,304 KB
testcase_14 AC 45 ms
24,264 KB
testcase_15 AC 41 ms
24,300 KB
testcase_16 AC 30 ms
23,592 KB
testcase_17 AC 28 ms
24,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdout
N = int(raw_input())
A = map(int,raw_input().split())
M = 0
op = []
for i in xrange(N):
	for j in xrange(N-i-1):
		if A[j]>A[j+1]:
			A[j],A[j+1]=A[j+1],A[j]
			M+=1
			op.append([j,j+1])
print M
for u,v in op:
	print u,v
stdout.flush()
input()
0