結果

問題 No.92 逃走経路
ユーザー BantakoBantako
提出日時 2017-08-21 13:03:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 759 bytes
コンパイル時間 1,312 ms
コンパイル使用メモリ 164,144 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-23 01:34:27
合計ジャッジ時間 2,094 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,940 KB
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.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
int p[1010][110];
main(){
    int N,M,K,A[1000],B[1000],C[1000],D[1000];
    cin >> N >> M >> K;
    for(int i = 0;i < M;i++)cin >> A[i] >> B[i] >> C[i];
    for(int i = 0;i < K;i++)cin >> D[i];
    for(int i = 0;i < M;i++){
        if(D[0] == C[i]){
            p[0][A[i]] = 1;
            p[0][B[i]] = 1;
        }
    }
    for(int i = 1;i < K;i++){
        for(int j = 0;j < M;j++){
            if(D[i] == C[j]){
                if(p[i-1][A[j]])p[i][B[j]] = 1;
                if(p[i-1][B[j]])p[i][A[j]] = 1;
            }
        }
    }
    cout << accumulate(p[K-1],p[K-1]+101,0) << endl;
    for(int i = 1;i <= 100;i++)if(p[K-1][i])cout << i << endl;
}
0