結果
問題 | No.92 逃走経路 |
ユーザー |
|
提出日時 | 2016-06-21 17:29:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 31 ms / 5,000 ms |
コード長 | 818 bytes |
コンパイル時間 | 958 ms |
コンパイル使用メモリ | 90,756 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 18:24:07 |
合計ジャッジ時間 | 1,856 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <iostream>#include <vector>#include <set>#include <map>#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))using namespace std;int main() {// inputint n, m, k; cin >> n >> m >> k;vector<map<int,vector<int> > > g(n);repeat (i,m) {int a, b, c; cin >> a >> b >> c; -- a; -- b;g[a][c].push_back(b);g[b][c].push_back(a);}vector<int> ds(k); repeat (i,k) cin >> ds[i];// searchset<int> xs; repeat (i,n) xs.insert(i);for (int d : ds) {set<int> ys;for (int x : xs) {if (g[x].count(d)) for (int y : g[x][d]) {ys.insert(y);}}xs = ys;}// outputcout << xs.size() << endl;for (int x : xs) cout << x + 1 << ' ';cout << endl;return 0;}