結果

問題 No.92 逃走経路
ユーザー sggkshiosggkshio
提出日時 2017-06-14 07:57:03
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 1,114 bytes
コンパイル時間 1,265 ms
コンパイル使用メモリ 92,836 KB
実行使用メモリ 814,668 KB
最終ジャッジ日時 2023-10-24 23:25:11
合計ジャッジ時間 9,365 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
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++) {
			
			for (int w = 0;w< x[g[i][j]].size(); w++) {
				if (x[g[i][j]][w].first == d)g[i + 1].push_back(x[g[i][j]][w].second);
			}
		}
		
	}
	sort(g[n-1].begin(), g[n-1].end());
	cout << g[n - 1].size() << endl;
	for (int i = 0; i < g[n-1].size(); i++) {
		if (i)cout << " ";
		cout << g[n-1][i]+1 ;
		if (i == g[n - 1].size() - 1)cout << endl;
	}

	return 0;
}
0