結果

問題 No.397 NO MORE KADOMATSU
ユーザー moti
提出日時 2018-05-26 02:30:57
言語 Perl
(5.40.0)
結果
TLE  
実行時間 -
コード長 419 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 6,812 KB
実行使用メモリ 40,784 KB
最終ジャッジ日時 2024-07-16 15:50:05
合計ジャッジ時間 6,553 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
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