結果
問題 | No.92 逃走経路 |
ユーザー |
![]() |
提出日時 | 2018-06-10 18:23:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 32 ms / 5,000 ms |
コード長 | 1,120 bytes |
コンパイル時間 | 916 ms |
コンパイル使用メモリ | 93,500 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 13:19:21 |
合計ジャッジ時間 | 2,023 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <algorithm>#include <cmath>#include <cstdio>#include <cstring>#include <deque>#include <iostream>#include <map>#include <queue>#include <set>#include <stack>#include <string>#include <utility>#include <vector>#define p(s) cout<<(s)<<endl#define REP(i,n,N) for(int i=n;i<N;i++)#define RREP(i,n,N) for(int i=N-1;i>=n;i--)#define CK(n,a,b) ((a)<=(n)&&(n)<(b))#define F first#define S secondtypedef long long int ll;using namespace std;const int inf=1e9+7;int N, M, K;vector<pair<int, int>> edge[110];set<int> s;int main(){cin>>N>>M>>K;REP(i,0,M){int a,b,c;cin>>a>>b>>c;a--;b--;edge[a].push_back({b,c});edge[b].push_back({a,c});}REP(i,0,N){s.insert(i);}REP(i,0,K){int d;cin>>d;set<int> nexts;for(auto st:s){for(auto v:edge[st])if(d==v.second){nexts.insert(v.first);}}s = nexts;}p(s.size());for(auto st:s){cout<<st+1<<" ";}cout<<endl;return 0;}