結果
| 問題 |
No.326 あみだますたー
|
| コンテスト | |
| ユーザー |
kurenai3110
|
| 提出日時 | 2016-06-28 17:32:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 686 bytes |
| コンパイル時間 | 516 ms |
| コンパイル使用メモリ | 61,052 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-11 22:35:58 |
| 合計ジャッジ時間 | 3,814 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 WA * 18 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n,k;
int cnt=0;
cin >>n>>k;
vector<int> x,y;
for(int i=0;i<k;i++){
int a,b;
cin>>a>>b;
x.push_back(a);
y.push_back(b);
}
vector<int> goal;
for(int i=0;i<n;i++){
int goal;
cin>>goal;
int pos=i+1;
for(int j=0;j<k+cnt;j++){
if(x[j]==pos){
pos++;
}else if(y[j]==pos){
pos--;
}
}
while(pos!=goal){
if(pos>goal){
x.push_back(pos-1);
y.push_back(pos);
pos--;
}else if(pos<goal){
x.push_back(pos);
y.push_back(pos+1);
pos++;
}
cnt++;
}
}
cout<<cnt<<endl;
for(int i=k;i<k+cnt;i++){
cout<<x[i]<<" "<<y[i]<<endl;
}
return 0;
}
kurenai3110