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>> Rclue, std::vector<std::vector<int>> Cclue) {
vector<vector<int>> ret(N, vector<int>(M));
for (int i = 0; i < N; i += 2) {
int s = 0;
for (int x : Rclue[i]) {
for (int j = s; j < s + x; j++)
ret[i][j] = 1;
s += x + 1;
}
}
for (int i = 0; i < M; i += 2) {
int s = 0;
for (int x : Cclue[i]) {
for (int j = s; j < s + x; j++)
ret[j][i] = 1;
s += x + 1;
}
}
for (int i = 1; i < N; i += 2) {
int s = ret[i][0] ? 0 : 1;
for (int x : Rclue[i]) {
for (int j = s; j < s + x; j++)
ret[i][j] = 1;
s += x + 1;
}
}
for (int i = 1; i < M; i += 2) {
int s = ret[0][i] ? 0 : 1;
for (int x : Cclue[i]) {
for (int j = s; j < s + x; j++)
ret[j][i] = 1;
s += x + 1;
}
}
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |