59 lines
800 B
C++
59 lines
800 B
C++
|
|
#include <locale.h>
|
|
|
|
#include <cmdln_flags.hpp>
|
|
|
|
#include <parse.hpp>
|
|
|
|
#include <build_automata.hpp>
|
|
|
|
#include <automata.hpp>
|
|
|
|
#include <find_solution.hpp>
|
|
|
|
#include <verify_solution.hpp>
|
|
|
|
int main(
|
|
int argc,
|
|
char* const* argv)
|
|
{
|
|
// to get printf to print numbers with commas:
|
|
setlocale(LC_ALL,"");
|
|
|
|
cmdln_flags flags(argc, argv);
|
|
|
|
auto problems = parse(flags.input_path);
|
|
|
|
for (const auto &problem: problems)
|
|
{
|
|
automata* start = build_automata(flags, problem);
|
|
|
|
auto solution = find_solution(problem, start);
|
|
|
|
solution->print();
|
|
|
|
if (flags.verify)
|
|
{
|
|
verify_solution(problem, solution);
|
|
}
|
|
|
|
automata::free(start);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|