-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bai5.cpp
51 lines (39 loc) · 1.25 KB
/
Bai5.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
49
50
51
void connectAllChains(vector<vector<TENode *>> &graph) {
for (auto origin : P) {
auto oldChains = getChains(graph, origin);
auto node = graph.at(get<0>(oldChains.at(0))).at(get<1>(oldChains.at(0)));
auto newChains = createNewChains(oldChains, H, deltaT);
auto newPos = insert(graph, newChains, node);
assert(checkResult(graph, newChains, newPos, node));
for (auto pair : newPos) {
spread(graph, pair.first, pair.second, H);
}
auto newOrder = merge(oldChains, newChains, newPos);
assert(checkNewOrder(allTENs, newOrder));
connectChains(allTENs, newOrder);
}
}
void Bai_5() {
// Bai 2
input2(file_parts);
solve2();
Assert_Bai2();
// Bai 3
vector<pii> initializations = getStartedNodes(allTENs);
for (auto pair : initializations)
{
spread(allTENs, pair.first, pair.second, H);
}
vector<pii> redundantNode = filter(allTENs);
remove(allTENs, redundantNode);
// kiem tra lai
Assert_Bai2();
Assert_Bai3();
// Bai 5
connectAllChains(allTENs);
redundantNode = filter(allTENs);
remove(allTENs, redundantNode);
sortGraph(allTENs);
Assert_Bai3();
printNumberOfTENodes(allTENs);
}