結果

問題 No.397 NO MORE KADOMATSU
ユーザー te-sh
提出日時 2017-07-27 12:11:12
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 404 bytes
コンパイル時間 815 ms
コンパイル使用メモリ 102,620 KB
実行使用メモリ 25,800 KB
平均クエリ数 36.83
最終ジャッジ日時 2024-06-12 21:14:48
合計ジャッジ時間 3,819 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 13
権限があれば一括ダウンロードができます

ソースコード

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