結果
問題 | No.92 逃走経路 |
ユーザー | sggkshio |
提出日時 | 2018-03-07 08:19:31 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 44 ms / 5,000 ms |
コード長 | 1,266 bytes |
コンパイル時間 | 912 ms |
コンパイル使用メモリ | 86,604 KB |
実行使用メモリ | 28,380 KB |
最終ジャッジ日時 | 2023-10-24 21:31:49 |
合計ジャッジ時間 | 2,324 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
28,376 KB |
testcase_01 | AC | 8 ms
28,316 KB |
testcase_02 | AC | 9 ms
28,316 KB |
testcase_03 | AC | 8 ms
28,316 KB |
testcase_04 | AC | 8 ms
28,316 KB |
testcase_05 | AC | 14 ms
28,336 KB |
testcase_06 | AC | 11 ms
28,336 KB |
testcase_07 | AC | 10 ms
28,336 KB |
testcase_08 | AC | 21 ms
28,316 KB |
testcase_09 | AC | 22 ms
28,320 KB |
testcase_10 | AC | 14 ms
28,380 KB |
testcase_11 | AC | 16 ms
28,372 KB |
testcase_12 | AC | 24 ms
28,344 KB |
testcase_13 | AC | 21 ms
28,320 KB |
testcase_14 | AC | 24 ms
28,324 KB |
testcase_15 | AC | 29 ms
28,336 KB |
testcase_16 | AC | 34 ms
28,348 KB |
testcase_17 | AC | 44 ms
28,372 KB |
testcase_18 | AC | 22 ms
28,356 KB |
testcase_19 | AC | 15 ms
28,356 KB |
ソースコード
#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[1005][1005]; 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[1005][1005] = {}; 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; }