結果
| 問題 |
No.429 CupShuffle
|
| コンテスト | |
| ユーザー |
notetonous
|
| 提出日時 | 2017-08-12 14:21:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 917 bytes |
| コンパイル時間 | 482 ms |
| コンパイル使用メモリ | 57,044 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 04:52:01 |
| 合計ジャッジ時間 | 1,634 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 16 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:12: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf(" %c",&s);
| ~~~~~^~~~~~~~~~
main.cpp:14:12: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf(" %c",&t);
| ~~~~~^~~~~~~~~~
ソースコード
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
int N,K,X;
int a[100001],b[100001],c[100001],x[100001];
int main(){
cin >> N >> K >> X;
for(int i=1;i<=K;i++){
if(i==X) {
char s,t;
scanf(" %c",&s);
scanf(" %c",&t);
//fflush(stdin);
}
else cin >> a[i] >> b[i];
}
for(int i=1;i<=N;i++)cin >> c[i];
for(int i=1;i<=N;i++)x[i]=i;
for(int i=1;i<X;i++){
int temp=x[a[i]];
x[a[i]]=x[b[i]];
x[b[i]]=temp;
}
for(int i=K;i>X;i--){
int temp=c[a[i]];
c[a[i]]=c[b[i]];
c[b[i]]=temp;
}
for(int i=1;i<=N;i++) cout << x[i] << " " ;
cout << endl;
for(int i=1;i<=N;i++) cout << c[i] << " " ;
cout << endl;
for(int i=1;i<=N;i++){
if(x[i]!=c[i]){
int temp=x[i];
x[i]=c[i];
c[i]=temp;
cout << i ;
if(i==N)cout << endl;
else cout << " ";
}
}
return 0;
}
notetonous