結果

問題 No.397 NO MORE KADOMATSU
ユーザー motimoti
提出日時 2018-05-26 02:31:16
言語 Perl
(5.38.2)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 5,328 KB
実行使用メモリ 24,396 KB
平均クエリ数 651.67
最終ジャッジ日時 2023-09-24 01:46:33
合計ジャッジ時間 2,224 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
23,376 KB
testcase_01 AC 29 ms
23,664 KB
testcase_02 AC 29 ms
24,276 KB
testcase_03 AC 29 ms
23,988 KB
testcase_04 AC 29 ms
23,364 KB
testcase_05 AC 31 ms
23,628 KB
testcase_06 AC 31 ms
24,396 KB
testcase_07 AC 31 ms
24,000 KB
testcase_08 AC 30 ms
23,820 KB
testcase_09 AC 29 ms
24,024 KB
testcase_10 AC 52 ms
24,264 KB
testcase_11 AC 28 ms
23,388 KB
testcase_12 AC 29 ms
24,000 KB
testcase_13 AC 37 ms
24,264 KB
testcase_14 AC 37 ms
23,988 KB
testcase_15 AC 38 ms
23,400 KB
testcase_16 AC 28 ms
24,268 KB
testcase_17 AC 28 ms
23,596 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use strict;
use warnings;

my $n = <>; chomp $n;
my $l = <>; chomp $l;
my @arr = split/ /,$l;

my @res;
for (my $i = 0; $i < @arr; $i++) {
  for (my $j = 0; $j < $i; $j++) {
    if ($arr[$i] < $arr[$j]) {
      ($arr[$i], $arr[$j]) = ($arr[$j], $arr[$i]);
      push @res, [$i, $j];
    }
  }
}

print scalar(@res) . "\n";
print(join(' ', ($_->[0], $_->[1])) . "\n") for @res;

#die 'no more kadomatsu' unless -1 == <>;
0