結果
問題 |
No.101 ぐるぐる!あみだくじ!
|
ユーザー |
![]() |
提出日時 | 2017-07-25 18:30:15 |
言語 | C (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 671 bytes |
コンパイル時間 | 350 ms |
コンパイル使用メモリ | 29,824 KB |
実行使用メモリ | 8,352 KB |
最終ジャッジ日時 | 2024-10-09 17:15:47 |
合計ジャッジ時間 | 14,573 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 33 TLE * 1 -- * 3 |
ソースコード
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(void){ int i,count=1; int origin[100],rule[100],before[100],after[100]; for(i=0;i<100;i++){ origin[i]=i; rule[i]=i; before[i]=i; } int n,k,x,y,tmp; scanf("%d%d",&n,&k); for(i=0;i<k;i++){ scanf("%d%d",&x,&y); tmp=rule[y-1]; rule[y-1]=rule[x-1]; rule[x-1]=tmp; } while(1){ for(i=0;i<n;i++){ after[i]=before[rule[i]]; } if(memcmp(after,origin,4*n)==0){ printf("%d\n",count); return 0; } memcpy(before,after,4*n); count++; } }