-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
55 lines (40 loc) · 1.31 KB
/
Copy pathmain.cpp
File metadata and controls
55 lines (40 loc) · 1.31 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
#include <cstdio>
#include <iostream>
#include "include/Pizza.hpp"
int main()
{
int rows = 0;
int cols = 0;
int min_ingr = 0;
int max_cells = 0;
std::scanf("%d %d %d %d", &rows, &cols, &min_ingr, &max_cells);
// Create pizza grid
char** pizza_grid = new char*[rows];
for (int i = 0; i < rows; ++i)
{
pizza_grid[i] = new char[cols];
}
// Read in the pizza
for (int i = 0; i < rows; ++i)
{
for (int j = 0; j < cols; ++j)
{
std::cin >> pizza_grid[i][j];
}
}
Pizza pizza(pizza_grid, rows, cols, min_ingr, max_cells);
//std::tuple<int, std::string> results = pizza.iterative_find();
//std::tuple<int, std::string> results = pizza.growing_iterative_find();
//std::tuple<int, std::string> results = pizza.shrinking_iterative_find();
std::tuple<int, std::string, int> tracker = std::make_tuple(0, "", 0);
std::tuple<int, std::string, int> results = pizza.recursive_best_find(tracker, 0, 0, pizza_grid);
std::cout << std::get<0>(results) << std::endl << std::get<1>(results);// << std::get<2>(results);
//std::cout << pizza.get_area_covered() << std::endl;
// Deallocation
for (int i = 0; i < rows; ++i)
{
delete[] pizza_grid[i];
}
delete[] pizza_grid;
return 0;
}