-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNonogram.h
36 lines (22 loc) · 851 Bytes
/
Nonogram.h
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
#pragma once
#include <vector>
class Nonogram {
public:
Nonogram(std::vector<std::vector<int>> &&rows, std::vector<std::vector<int>> &&cols, size_t width, size_t height);
void Solve();
void Increase(size_t coefficient);
[[nodiscard]] size_t GetWidth() const;
[[nodiscard]] size_t GetHeight() const;
[[nodiscard]] int GetCell(size_t i, size_t j) const;
private:
static bool CanMakeCorrect(std::vector<int> &correct, std::vector<int> ¤t);
void TryPaintCell(size_t i, size_t j);
bool DoOneIteration();
[[nodiscard]] std::vector<int> GetColumn(size_t i) const;
[[nodiscard]] std::vector<int> GetRow(size_t i) const;
std::vector<std::vector<int>> matrix_;
std::vector<std::vector<int>> rows_;
std::vector<std::vector<int>> cols_;
size_t width_ = 0;
size_t height_ = 0;
};