結果

問題 No.92 逃走経路
ユーザー niyarinniyarin
提出日時 2016-06-21 17:45:50
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,106 bytes
コンパイル時間 840 ms
コンパイル使用メモリ 22,272 KB
実行使用メモリ 9,856 KB
最終ジャッジ日時 2024-04-19 23:40:55
合計ジャッジ時間 16,649 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:30:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   30 |     scanf("%d %d %d",&N,&M,&K);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:33:19: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   33 |         int a,b,c;scanf("%d %d %d",&a,&b,&c);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:41:22: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   41 |     for (i=0;i<K;i++)scanf("%d",&D[i]);
      |                      ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

int N,M,K;

int p[1001][100];
int F[100][100][1000] = {0};
int fsz[100][100] = {0};
int D[1000] = {0};




void nyrn(int index,int n){
    int i,j,k;
    if (p[index][n])return;
    p[index][n] = 1;
    if (index == K)return;
    for (i=0;i<N;i++){
        for (j=0;j<N;j++){
            for (k=0;k<fsz[i][j];k++){
                if (F[i][j][k] == D[index]){
                    nyrn(index+1,j);
                }
            }
        }
    }
}

int main(void){
    scanf("%d %d %d",&N,&M,&K);
    int i=0;
    for (i=0;i<M;i++){
        int a,b,c;scanf("%d %d %d",&a,&b,&c);
        a--;
        b--;
        F[a][b][fsz[a][b]] = c;
        F[b][a][fsz[b][a]] = c;
        fsz[a][b]++;
        fsz[b][a]++;
    }
    for (i=0;i<K;i++)scanf("%d",&D[i]);

    for (i=0;i<N;i++)nyrn(0,i);
    int anss=0,ans[100]={0};
    for (i=0;i<N;i++){
        if (p[K-1][i]){
            ans[anss] = i;
            anss++;
        }
    }
    printf("%d\n",anss);
    for (i=0;i<anss;i++){
        printf("%d",ans[i]);
        if (i!=anss-1)printf(" ");
    }
    printf("\n");
    return 0;
}




0