This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (i % 2 && 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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |