結果

問題 No.92 逃走経路
ユーザー sggkshiosggkshio
提出日時 2018-03-07 08:10:28
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,262 bytes
コンパイル時間 732 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 18:45:07
合計ジャッジ時間 3,600 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#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 <ctype.h>
using namespace std;

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

vector<long long int> f[105][105];

int main() {
	/*
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			f[i][j] = 100000000000;
		}
	}
	*/

	int n, m, k;
	
	cin >> n >> m >> k;
	for (int i = 0; i < m; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		f[a][b].push_back(c);
		f[b][a].push_back(c);
	}
	int x = n;
	bool g[105][105] = {};
	for (int i = 0; i <= n; i++) {
		g[0][i] = 1;
	}
	for (int i = 0; i < k; i++) {
		int d;
		cin >> d;
		for (int j = 1; j <= n; j++) {
			for (int y = 1; y <= n; y++) {
				//cout << f[i][j];
				for(int t=0;t<f[j][y].size();t++)
				if (f[j][y][t] == d) {
				//	cout << "#"; cout << i << j;
					g[i + 1][y] += g[i][j];
				}
			}
			
		}
	}
	x = 0;
	for (int i = 0; i <= n; i++)x += g[k][i];
	cout << x << endl;
	for (int i = 1; i <= n; i++) {
		if (!g[k][i])continue;
		cout << i << " ";

	}
	cout << endl;

	return 0;
}
0