-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsudoku.cpp
56 lines (50 loc) · 1.66 KB
/
sudoku.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
52
53
54
55
56
///////// 2020. GNU GENERAL PUBLIC LICENSE /////////////////////////
//
// Project : Solucionador de Sudoku
// File : sudoku.cpp
// Description :
// Funcion principal y punto de entrada del programa.
//
// Authors : E. Rodriguez
// Keylor D. Muños Soto
//
// Git repository: https://github.com/bejarane/sudoku
////////////////////////////////////////////////////////////////////
#include <bits/stdc++.h>
#include <clases.h>
using namespace std;
//#define INTERNAL_TIME
int main(){
int casos = 0;
string buffer;
DPRINTLN("Inicio");
while(getline(cin,buffer)){
if (buffer.empty())continue;
casos = stoi(buffer);
while(casos>0){
casos --;
#ifdef INTERNAL_TIME
auto current_time = std::chrono::high_resolution_clock::now();
auto start_time = std::chrono::high_resolution_clock::now();
#endif
Sudoku prueba;
if(!prueba.leerMatriz()){
cout << "Matriz inválida, número repetido" << endl;
continue;
}
DPRINTLN("Imprime");
DPRINTLN('\n');
if(prueba.resolver()){
#ifdef INTERNAL_TIME
current_time = std::chrono::high_resolution_clock::now();
#endif
prueba.imprimir(prueba.solucion,false,false);
#ifdef INTERNAL_TIME
cout << "Tiempo de resolucion: " << std::chrono::duration_cast<std::chrono::milliseconds>(current_time - start_time).count() << " ms" << std::endl;
#endif
}
}
break;
}
return 0;
}