結果
| 問題 |
No.92 逃走経路
|
| コンテスト | |
| ユーザー |
Zu_rin
|
| 提出日時 | 2020-09-09 11:33:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,116 bytes |
| コンパイル時間 | 980 ms |
| コンパイル使用メモリ | 86,992 KB |
| 実行使用メモリ | 10,272 KB |
| 最終ジャッジ日時 | 2024-12-14 15:17:59 |
| 合計ジャッジ時間 | 79,943 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | WA * 6 TLE * 12 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <set>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30
using namespace std;
typedef long long ll;
typedef pair<int, int> pp;
void DFS(int n, int dep, vector<list<pp>> & d, vector<int> & t, set<int> &ans) {
if (dep == t.size()) {
ans.insert(n);
return;
}
int& x = t[dep];
for (auto it = d[n].begin(); it != d[n].end(); it++) {
if ((*it).first == x) {
DFS((*it).second, dep + 1, d, t, ans);
}
}
return;
}
int main(void) {
int num, m, k, i, a, b, c;
cin >> num >> m >> k;
vector<list<pp>> d(num + 1);
vector<int> t(k);
set<int> ans;
rep(i, m) {
cin >> a >> b >> c;
d[a].push_back(pp(c, b));
d[b].push_back(pp(c, a));
}
rep(i, k) {
cin >> t[i];
}
for (i = 1; i <= num; i++) {
DFS(i, 0, d, t, ans);
}
cout << ans.size() << "\n";
for (auto it = ans.begin(); it != ans.end(); it++) {
cout << *it << "\n";
}
return 0;
}
Zu_rin