#include "nonogram.h"
using namespace std;
std::vector<std::vector<int>> SolveNonogram(int n, int m, std::vector<std::vector<int>> r, std::vector<std::vector<int>> c) {
vector<vector<int>> z(n);
for (int i = 0; i < n; i++) z[i].resize(m);
for (int i = 0; i < n; i++) {
if (r[i][0] == m - 1) {
for (int j = 1; j + 1 < m; j++) z[i][j] = 1;
} else {
int d = i % 2;
if (r[i][0] % 2 == 0) r[i][0]--, z[i][0] = 1;
for (int j : r[i]) {
while (j--) z[i][d++] = 1;
d++;
}
}
}
int d = 0;
for (int j : c[0]) {
while (j--) {
z[d][0] = 1;
d++;
}
if (d < n && r[d][0] == m - 1) z[d][m - 1] = 1;
d++;
}
return z;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |