結果

問題 No.92 逃走経路
ユーザー BantakoBantako
提出日時 2017-08-21 13:05:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 775 bytes
コンパイル時間 1,359 ms
コンパイル使用メモリ 163,796 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-23 01:34:30
合計ジャッジ時間 1,969 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 4 ms
6,940 KB
testcase_06 AC 3 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 4 ms
6,944 KB
testcase_11 AC 3 ms
6,940 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 3 ms
6,944 KB
testcase_15 AC 4 ms
6,944 KB
testcase_16 AC 4 ms
6,944 KB
testcase_17 AC 4 ms
6,944 KB
testcase_18 AC 4 ms
6,940 KB
testcase_19 AC 3 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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])printf("%d ",i);
    cout << endl;
}
0