結果

問題 No.397 NO MORE KADOMATSU
ユーザー ​
提出日時 2016-11-12 20:12:56
言語 Python2
(2.7.18)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 281 bytes
コンパイル時間 50 ms
コンパイル使用メモリ 6,508 KB
実行使用メモリ 24,372 KB
平均クエリ数 936.56
最終ジャッジ日時 2023-09-24 00:42:00
合計ジャッジ時間 2,082 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
23,520 KB
testcase_01 AC 35 ms
23,376 KB
testcase_02 AC 35 ms
24,264 KB
testcase_03 AC 37 ms
23,616 KB
testcase_04 AC 35 ms
23,400 KB
testcase_05 AC 36 ms
23,388 KB
testcase_06 AC 39 ms
23,412 KB
testcase_07 AC 40 ms
24,264 KB
testcase_08 AC 36 ms
24,288 KB
testcase_09 AC 35 ms
23,964 KB
testcase_10 AC 61 ms
23,640 KB
testcase_11 AC 35 ms
24,372 KB
testcase_12 AC 45 ms
23,340 KB
testcase_13 AC 49 ms
23,364 KB
testcase_14 AC 49 ms
23,532 KB
testcase_15 AC 48 ms
24,324 KB
testcase_16 AC 35 ms
23,388 KB
testcase_17 AC 35 ms
23,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = input()

A = map(eval, raw_input().strip().split())
assert len(A) == n

l = []
for i in xrange(len(A)):
  for j in xrange(1, len(A) - i):
    if A[j] < A[j-1]:
      A[j], A[j-1] = A[j-1], A[j]
      l += [(j, j-1)]

print len(l)
print "\n".join(map(lambda x: "%d %d" % x, l))
0