結果

問題 No.429 CupShuffle
ユーザー DugongDugong
提出日時 2016-10-04 20:21:55
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 812 bytes
コンパイル時間 409 ms
コンパイル使用メモリ 24,704 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-21 16:47:44
合計ジャッジ時間 1,087 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |   scanf("%d %d %d",&n,&k,&X);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~
main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |     scanf("%d %d",&a,&b);
      |     ~~~~~^~~~~~~~~~~~~~~
main.cpp:19:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |   scanf("%s %s",dummy,dummy+4);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
main.cpp:23:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |     scanf("%d %d",&p,&q);
      |     ~~~~~^~~~~~~~~~~~~~~
main.cpp:31:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   31 |     scanf("%d",c+i);
      |     ~~~~~^~~~~~~~~~

ソースコード

diff #
プレゼンテーションモードにする

#include<cstdio>
#include<cstring>
int main(){
int n,k,X;
scanf("%d %d %d",&n,&k,&X);
int x[n];
for(int i=0;i<n;i++) x[i] = i;
for(int i=0;i<X-1;i++){
int a,b;
scanf("%d %d",&a,&b);
a--;
b--;
int t = x[a];
x[a] = x[b];
x[b] = t;
}
char dummy[20];
scanf("%s %s",dummy,dummy+4);
int a[k],b[k];
for(int i=0;i<k-X;i++){
int p,q;
scanf("%d %d",&p,&q);
p--;
q--;
a[i] = p;
b[i] = q;
}
int c[n];
for(int i=0;i<n;i++){
scanf("%d",c+i);
c[i]--;
}
for(int i=k-X-1;i>=0;i--){
int t = c[a[i]];
c[a[i]] = c[b[i]];
c[b[i]] = t;
}
bool flag = false;
for(int i=0;i<n;i++){
if(c[i]!=x[i]){
if(!flag){
printf("%d ",i+1);
flag = true;
}else{
printf("%d\n",i+1);
}
}
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0