結果

問題 No.101 ぐるぐる!あみだくじ!
ユーザー basscl_sugibasscl_sugi
提出日時 2017-07-25 18:30:15
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 671 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 30,720 KB
実行使用メモリ 8,480 KB
最終ジャッジ日時 2024-04-17 23:31:24
合計ジャッジ時間 14,798 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 80 ms
6,940 KB
testcase_12 AC 83 ms
6,944 KB
testcase_13 AC 71 ms
6,940 KB
testcase_14 AC 118 ms
6,940 KB
testcase_15 AC 8 ms
6,940 KB
testcase_16 AC 10 ms
6,944 KB
testcase_17 AC 12 ms
6,944 KB
testcase_18 AC 15 ms
6,940 KB
testcase_19 AC 17 ms
6,944 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 26 ms
6,940 KB
testcase_23 AC 15 ms
6,940 KB
testcase_24 AC 233 ms
6,940 KB
testcase_25 AC 161 ms
6,944 KB
testcase_26 AC 117 ms
6,944 KB
testcase_27 AC 1,800 ms
6,940 KB
testcase_28 AC 1,092 ms
6,940 KB
testcase_29 AC 1,004 ms
6,944 KB
testcase_30 AC 824 ms
6,944 KB
testcase_31 AC 815 ms
6,940 KB
testcase_32 AC 801 ms
6,940 KB
testcase_33 TLE -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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++;
    }
}
0