結果
| 問題 | No.429 CupShuffle |
| コンテスト | |
| ユーザー |
rapurasu
|
| 提出日時 | 2016-10-21 21:46:42 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 52 ms / 2,000 ms |
| コード長 | 927 bytes |
| 記録 | |
| コンパイル時間 | 1,083 ms |
| コンパイル使用メモリ | 176,796 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-17 09:31:01 |
| 合計ジャッジ時間 | 2,652 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:51:13: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized]
51 | if(B[i]==x){
| ^~
main.cpp:42:13: note: 'x' was declared here
42 | int x,y,c=0;
| ^
main.cpp:54:13: warning: 'y' may be used uninitialized [-Wmaybe-uninitialized]
54 | if(B[i]==y){
| ^~
main.cpp:42:15: note: 'y' was declared here
42 | int x,y,c=0;
| ^
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/algorithm:62,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:53,
from main.cpp:1:
In function 'const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = int]',
inlined from 'int main()' at main.cpp:59:35:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:263:7: warning: 'xx' may be used uninitialized [-Wmaybe-uninitialized]
263 | if (__a < __b)
| ^~
main.cpp: In function 'int main()':
main.cpp:49:13: note: 'xx' was declared here
49 | int xx,yy;
| ^~
In function 'const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = int]',
inlined from 'int main()' at main.cpp:59:35:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:263:7: warning: 'yy' may be used uninitialized [-Wmaybe-uninitialized]
263 | if (__a < __b)
| ^~
main.cpp: In function 'int main()':
main.cpp:49:16: note: 'yy' was declared here
49 | int xx,yy;
| ^~
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
int N;
int K;
int X;
int A[100001];
int B[100001];
int C[100001];
void swap(int x,int y){
int temp=A[x];
A[x]=A[y];
A[y]=temp;
}
int main(){
cin>>N>>K>>X;
REP(i,N){
A[i]=i+1;
}
REP(i,K){
if(i==X-1){
string s,ss;
cin>>s>>ss;
REP(i,N){
B[i]=A[i];
}
}else{
int a,b;
cin>>a>>b;
swap(a-1,b-1);
}
}
REP(i,N){
cin>>C[i];
}
//違う場所を探す
int x,y,c=0;
REP(i,N){
if(A[i]!=C[i]){
x=A[i];
y=C[i];
}
}
int xx,yy;
REP(i,N){
if(B[i]==x){
xx=i+1;
}
if(B[i]==y){
yy=i+1;
}
}
cout<<min(xx,yy)<<" "<<max(xx,yy)<<endl;
return(0);
}
rapurasu