結果

問題 No.397 NO MORE KADOMATSU
ユーザー te-shte-sh
提出日時 2017-07-27 12:11:12
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 404 bytes
コンパイル時間 637 ms
コンパイル使用メモリ 89,116 KB
実行使用メモリ 24,372 KB
平均クエリ数 36.83
最終ジャッジ日時 2023-09-03 15:32:59
合計ジャッジ時間 4,373 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 26 ms
24,372 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 25 ms
23,412 KB
testcase_10 WA -
testcase_11 AC 25 ms
24,036 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 24 ms
24,312 KB
testcase_17 AC 24 ms
23,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto n = readln.chomp.to!size_t;
  auto a = readln.split.to!(int[]);

  size_t[][] r;
  foreach (i; 0..n) {
    auto j = a[i..$].minIndex + i;
    if (i != j) {
      swap(a[i], a[j]);
      r ~= [i, j];
    }
  }

  writeln(r.length);
  foreach (ri; r)
    writeln(ri[0]+1, " ", ri[1]+1);
  stdout.flush();

  readln;
}
0