結果

問題 No.92 逃走経路
ユーザー goodbatongoodbaton
提出日時 2015-08-11 01:19:26
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,145 bytes
コンパイル時間 751 ms
コンパイル使用メモリ 71,744 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-25 08:02:15
合計ジャッジ時間 1,549 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>

typedef long long ll;
using namespace std;

#define mod 1000000007
#define INF 1000000000
#define LLINF 2000000000000000000LL
#define PI 3.1415926536

#define SIZE 1000

int main(){
    int n,m,k,a[SIZE],b[SIZE],c[SIZE],d,ans=0;
    bool dp[1010][101]={0};
    
    scanf("%d%d%d",&n,&m,&k);
    
    for(int i=0;i<m;i++){
        scanf("%d%d%d",&a[i],&b[i],&c[i]);
    }
    
    for(int i=1;i<=n;i++){
        dp[0][i]=true;
    }
    
    for(int i=0;i<k;i++){
        scanf("%d",&d);
        
        for(int j=0;j<m;j++){
            if(c[j]==d){
                
                dp[i+1][b[j]]|=true;
                
                dp[i+1][a[j]]|=true;
                
            }
        }
    }
    
    for(int i=1;i<=n;i++)
        if(dp[k][i]) ans++;
    
    printf("%d\n",ans);
    
    for(int i=1;i<=n;i++){
        if(dp[k][i]){
            printf(i<n?"%d ":"%d\n",i);
        }
    }
    
    
    return 0;
}
0