結果
| 問題 |
No.92 逃走経路
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-10 06:59:03 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 928 bytes |
| コンパイル時間 | 1,622 ms |
| コンパイル使用メモリ | 172,700 KB |
| 実行使用メモリ | 821,060 KB |
| 最終ジャッジ日時 | 2024-06-24 07:34:22 |
| 合計ジャッジ時間 | 14,107 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | MLE * 1 -- * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,first,last) for (int i=first;i<last;++i)
#define MAX(x,y) (x > y ? x : y)
#define MIN(x,y) (x < y ? x : y)
int N,M,K;
int main(){
cin >> N >> M >> K;
vector<map<int, vector<int>>> town_info(N+1);
REP(i,0,M){
int a,b,c;
cin >> a >> b >> c;
town_info[a][c].push_back(b);
town_info[b][c].push_back(a);
}
vector<int> d_list(K);
REP(i,0,K){
cin >> d_list[i];
}
vector<int> candidate_towns;
REP(i,0,N){
candidate_towns.push_back(i + 1);
}
for (int d: d_list) {
vector<int> rest_towns;
for (int c: candidate_towns) {
if (town_info[c][d].size() != 0) {
for (int t: town_info[c][d]) {
rest_towns.push_back(t);
}
}
}
candidate_towns = rest_towns;
}
cout << candidate_towns.size() << endl;
for (int c: candidate_towns) {
cout << c << " ";
}
cout << endl;
}