結果

問題 No.92 逃走経路
ユーザー kotamanegikotamanegi
提出日時 2017-01-03 11:18:54
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 10 ms / 5,000 ms
コード長 1,360 bytes
コンパイル時間 981 ms
コンパイル使用メモリ 90,652 KB
実行使用メモリ 21,588 KB
最終ジャッジ日時 2023-08-22 10:12:57
合計ジャッジ時間 2,217 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
21,416 KB
testcase_01 AC 6 ms
21,336 KB
testcase_02 AC 6 ms
21,276 KB
testcase_03 AC 6 ms
21,360 KB
testcase_04 AC 6 ms
21,424 KB
testcase_05 AC 8 ms
21,368 KB
testcase_06 AC 9 ms
21,420 KB
testcase_07 AC 9 ms
21,344 KB
testcase_08 AC 6 ms
21,308 KB
testcase_09 AC 7 ms
21,588 KB
testcase_10 AC 10 ms
21,320 KB
testcase_11 AC 9 ms
21,320 KB
testcase_12 AC 9 ms
21,424 KB
testcase_13 AC 7 ms
21,292 KB
testcase_14 AC 7 ms
21,456 KB
testcase_15 AC 8 ms
21,436 KB
testcase_16 AC 8 ms
21,340 KB
testcase_17 AC 9 ms
21,436 KB
testcase_18 AC 9 ms
21,372 KB
testcase_19 AC 8 ms
21,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONG_INF 100000000000000
vector<pair<int, int>> vertex[10000];
bool can_be[2000][10000] = {};
int main() {
	iostream::sync_with_stdio(false);
	int n, m, k;
	cin >> n >> m >> k;
	REP(i, m) {
		int a, b, c;
		cin >> a >> b >> c;
		vertex[a].push_back(make_pair(c, b));
		vertex[b].push_back(make_pair(c, a));
	}
	REP(i, 2000) {
		can_be[i][0] = true;
	}
	for (int i = 0;i < k;++i) {
		int d;
		cin >> d;
		for (int q = 1;q <= n;++q) {
			if (can_be[q][i] == true) {
				for (int j = 0;j < vertex[q].size();++j) {
					if (vertex[q][j].first == d) {
						can_be[vertex[q][j].second][i + 1] = true;
					}
				}
			}
		}
	}
	vector<int> nya;
	for (int i = 0;i <= n;++i) {
		if (can_be[i][k]) {
			nya.push_back(i);
		}
	}
	cout << nya.size() << endl;
	for (int i = 0;i < nya.size();++i) {
		cout << nya[i] << " ";
	}
	cout << endl;
	return 0;
}
0