結果

問題 No.397 NO MORE KADOMATSU
ユーザー Tawara
提出日時 2016-07-20 21:22:57
言語 Python2
(2.7.18)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 267 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 25,476 KB
平均クエリ数 936.56
最終ジャッジ日時 2024-07-17 00:15:39
合計ジャッジ時間 2,292 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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