結果
| 問題 |
No.397 NO MORE KADOMATSU
|
| コンテスト | |
| ユーザー |
conf
|
| 提出日時 | 2016-07-15 22:49:01 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 2,000 ms |
| コード長 | 541 bytes |
| コンパイル時間 | 661 ms |
| コンパイル使用メモリ | 65,944 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 36.83 |
| 最終ジャッジ日時 | 2024-07-17 00:04:55 |
| 合計ジャッジ時間 | 2,053 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int N;
cin>>N;
vector<int> V(N);
vector<pair<int,int>> H;
for(int i=0;i<N;i++)cin>>V[i];
for(int i=0;i<N;i++){
auto m = min_element(V.begin()+i,V.end());
if(m!=V.begin()+i){
int j=m-V.begin();
swap(V[i],V[j]);
H.emplace_back(i,j);
}
}
cout<<H.size()<<endl;
for(auto &h:H){
cout<<h.first<<' '<<h.second<<endl;
}
cout<<flush;
cin>>N;
}
conf