結果
| 問題 | No.92 逃走経路 |
| コンテスト | |
| ユーザー |
she11code
|
| 提出日時 | 2015-05-06 03:21:41 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,542 bytes |
| 記録 | |
| コンパイル時間 | 1,328 ms |
| コンパイル使用メモリ | 169,740 KB |
| 実行使用メモリ | 1,350,400 KB |
| 最終ジャッジ日時 | 2024-07-05 19:11:14 |
| 合計ジャッジ時間 | 14,050 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | MLE * 1 -- * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define LOG(...) fprintf(stderr,__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
struct Edge {
int to, cost;
};
struct P {
int town, k;
};
int main() {
int town_n, road_n, k;
cin >> town_n >> road_n >> k;
vector<vector<Edge> > E(town_n + 1);
REP(i, road_n) {
int a, b, c;
cin >> a >> b >> c;
E[a].push_back({ b, c });
E[b].push_back({ a, c });
}
vi costs(k);
REP(i, k) cin >> costs[i];
vi towns;
queue<P> que;
REP(i, town_n) {
que.push({i+1, 0});
}
while (!que.empty()) {
P p = que.front(); que.pop();
if (p.k == k) {
towns.push_back(p.town);
}
for (Edge& e : E[p.town]) {
if (e.cost == costs[p.k]) {
que.push({e.to, p.k+1});
}
}
}
cout << towns.size() << endl;
cout << towns[0];
FOR(i, 1, towns.size()) {
cout << " " << towns[i];
}
cout << endl;
}
she11code