diff options
1 files changed, 12 insertions, 1 deletions
| -rw-r--r-- | Year 4/Artificial Intelligence/hw01/main.cpp | 13 |
diff --git a/Year 4/Artificial Intelligence/hw01/main.cpp b/Year 4/Artificial Intelligence/hw01/main.cpp index 87e6167..17b568b 100644 --- a/Year 4/Artificial Intelligence/hw01/main.cpp +++ b/Year 4/Artificial Intelligence/hw01/main.cpp @@ -5,10 +5,12 @@ #include <math.h> #include <climits> #include <cassert> +#include <chrono> // #include "graph.h" using namespace std; +using namespace chrono; int I, N = 0; @@ -171,7 +173,7 @@ bool solvable(Node* root) { } } -int main() { +int main(int argc, char* argv[]) { /* Input */ cin >> N >> I; if (I == -1) { I = N; } @@ -200,11 +202,15 @@ int main() { path.push_back(root); /* IDA* */ + auto startTime = system_clock::now(); + int bound = 3; while(bound != SOLVED) { bound = dfs(path, bound); } + auto endTime = system_clock::now(); + /* Output */ cout << (path.size() - 1) << endl; for (int i = 1; i < path.size(); i++) { @@ -212,4 +218,9 @@ int main() { delete path[i]; } delete root; + + if (argc > 1) { + auto millis = duration_cast<std::chrono::milliseconds>(endTime - startTime).count(); + std::cout << "Took: " << millis / 1000.0 << "s" << std::endl; + } } |
