結果

問題 No.1805 Approaching Many Typhoon
ユーザー ytftytft
提出日時 2022-02-16 01:27:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 742 bytes
コンパイル時間 1,823 ms
コンパイル使用メモリ 179,048 KB
実行使用メモリ 19,328 KB
最終ジャッジ日時 2023-09-11 17:05:10
合計ジャッジ時間 4,826 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 WA -
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 WA -
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,384 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 30 ms
19,012 KB
testcase_29 AC 31 ms
19,328 KB
testcase_30 AC 31 ms
19,208 KB
testcase_31 AC 31 ms
19,148 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 7 ms
4,552 KB
testcase_35 AC 7 ms
6,280 KB
testcase_36 AC 10 ms
8,068 KB
testcase_37 AC 2 ms
4,384 KB
testcase_38 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    set<int> I,reach;
    int N,M,S,G,U,input;
    cin>>N>>M>>S>>G;
    int E[M][2];
    vector<vector<int>> C(N,vector<int>(N));
    queue<int> Q;
    Q.push(S-1);
    for(int i=0;i<M;++i){
        cin>>E[i][0]>>E[i][1];
    }
    cin>>U;
    for(int i=0;i<U;++i){
        cin>>input;
        I.insert(input);
    }
    for(int i=0;i<M;++i){
        if(!I.count(E[i][1])){
            C[E[i][0]-1].emplace_back(E[i][1]-1);
        }
    }
    while(!Q.empty()){
        reach.insert(Q.front());
        for(int i:C[Q.front()]){
            if(!reach.count(i)){
                Q.push(i);
            }
        }
        Q.pop();
    }
    cout<<(reach.count(G-1)?"Yes":"No")<<endl;
}
0