結果
問題 |
No.429 CupShuffle
|
ユーザー |
![]() |
提出日時 | 2016-12-09 14:45:38 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 703 bytes |
コンパイル時間 | 206 ms |
コンパイル使用メモリ | 21,504 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-28 16:17:49 |
合計ジャッジ時間 | 1,003 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 |
コンパイルメッセージ
main.c: In function ‘run’: main.c:5:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d%d%d",&n,&k,&x); | ^~~~~~~~~~~~~~~~~~~~~~~~ main.c:15:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d%d",A+i,B+i); | ^~~~~~~~~~~~~~~~~~~~~ main.c:25:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 25 | scanf("%d%d",A+i,B+i); | ^~~~~~~~~~~~~~~~~~~~~ main.c:30:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 30 | scanf("%d",C+i); | ^~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> void run(void){ int n,k,x; scanf("%d%d%d",&n,&k,&x); int A[100001]; int B[100001]; int D[100001]; int i; for(i=1;i<=n;i++){ D[i]=i; } for(i=1;i<x;i++){ scanf("%d%d",A+i,B+i); int t=D[A[i]]; D[A[i]]=D[B[i]]; D[B[i]]=t; } while(getchar()!='\n'); while(getchar()!='\n'); for(i=x+1;i<=k;i++){ scanf("%d%d",A+i,B+i); } int C[100001]; for(i=1;i<=n;i++){ scanf("%d",C+i); } for(i=k;i>x;i--){ int t=C[A[i]]; C[A[i]]=C[B[i]]; C[B[i]]=t; } i=1; while(C[i]==D[i]){ i++; } printf("%d",i); i++; while(C[i]==D[i]){ i++; } printf(" %d\n",i); return; } int main(void){ run(); return 0; }