結果

問題 No.92 逃走経路
ユーザー sggkshiosggkshio
提出日時 2017-06-14 08:29:21
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,195 bytes
コンパイル時間 786 ms
コンパイル使用メモリ 92,484 KB
実行使用メモリ 344,892 KB
最終ジャッジ日時 2023-10-24 22:26:47
合計ジャッジ時間 13,775 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>

//#include<bits/stdc++.h>


using namespace std;
vector<int>g[1005];
int main() {

	int n, m, k;
	cin >> n >> m >> k;
	vector<pair<int, int>>x[102];
	for (int i = 0; i < m; i++) {
		int a, b, j;
		cin >> a >> b >> j;
		a--; b--;
		x[a].push_back(make_pair(j, b));
		x[b].push_back(make_pair(j, a));
	}
	
	for (int i = 0; i < n; i++) {
		g[0].push_back(i);
	}
	for (int i = 0; i < k; i++) {
		int d;
		cin >> d;
		for (int j = 0; j < g[i].size(); j++) {
			bool f[10005] = {};
			for (int w = 0;w< x[g[i][j]].size(); w++) {
				if (x[g[i][j]][w].first == d&&f[x[g[i][j]][w].second] == 0) {
					g[i + 1].push_back(x[g[i][j]][w].second);
					f[x[g[i][j]][w].second] = 1;

				}
			}
		}
		
	}
	sort(g[k].begin(), g[k].end());
	cout << g[k].size() << endl;
	for (int i = 0; i < g[k].size(); i++) {
		if (i)cout << " ";
		cout << g[k][i]+1 ;
		if (i == g[k].size() - 1)cout << endl;
	}

	return 0;
}
0