-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbond.cpp
48 lines (46 loc) · 908 Bytes
/
bond.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* Bond */
#include <stdio.h>
#include <stack>
using namespace std;
int
main(void)
{
while(1) {
int n, m, q;
vector<int> d; /* danger */
vector<int, int> t; /* towns */
vector<int, int, int> e; /* edges */
vector<vector<int, int>> g;
scanf("%d %d", &n, &m);
for (int i = 0; i < m; i++) {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
e.push_back(tuple<int, int, int>(a, b, c));
g.push_back(vector<int, int>());
g[b].push_back(pair<int, int>(b, c));
g[c].push_back(pair<int, int>(b, a));
}
scanf("%d", &q);
for (int i = 0; i < q; i++) {
int a, b;
scanf("%d %d", &a, &b);
t.push_back(pair<int, int>(a, b));
}
k = -1;
while (k++) {
for (auto p : t) {
/* DFS */
stack<int> stack;
stack.push(p.first);
while(!q.empt(t()) {
int v = q.top();
q.pop();
for (auto w : g[v]) {
/* DFS */
}
}
}
}
}
return 0;
}