-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
58 lines (55 loc) · 2.03 KB
/
Copy pathmain.cpp
File metadata and controls
58 lines (55 loc) · 2.03 KB
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
52
53
54
55
56
57
58
#include <cstring>
#include "iostream"
#include "utils.h"
#include "string"
#include "search.h"
int main(int argc, char **argv) {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
if (argc < 8) {
std::cout << "Not enough parameters" << "\n";
return 1;
}
if (strcmp(argv[1], "preprocess") == 0) {
std::string nodesFilename, edgesFilename, outputFilename;
for (int i = 2; i < argc; ++i) {
if (strcmp(argv[i], "--nodes") == 0) {
nodesFilename = argv[i + 1];
} else if (strcmp(argv[i], "--edges") == 0) {
edgesFilename = argv[i + 1];
} else if (strcmp(argv[i], "--output") == 0) {
outputFilename = argv[i + 1];
}
}
if (nodesFilename.empty() || edgesFilename.empty() || outputFilename.empty()) {
std::cout << "Wrong parameters" << "\n";
return 1;
}
prepareFile(nodesFilename, edgesFilename, outputFilename);
} else if (strcmp(argv[1], "search") == 0) {
std::string graphFilename, inputFilename, outputFilename;
bool isDetailed = false;
for (int i = 2; i < argc; ++i) {
if (strcmp(argv[i], "--graph") == 0) {
graphFilename = argv[i + 1];
} else if (strcmp(argv[i], "--input") == 0) {
inputFilename = argv[i + 1];
} else if (strcmp(argv[i], "--output") == 0) {
outputFilename = argv[i + 1];
} else if (strcmp(argv[i], "--full-output") == 0) {
isDetailed = true;
}
}
if (graphFilename.empty() || inputFilename.empty() || outputFilename.empty()) {
std::cout << "Wrong parameters" << "\n";
return 1;
}
solve(graphFilename, inputFilename, outputFilename, isDetailed);
} else {
std::cout << "Wrong mode\n";
return 1;
}
// prepareFile("n_gen.txt", "e_gen.txt", "g.txt");
// solve("g.txt", "q_gen.txt", "res.txt", true);
return 0;
}