# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147633 | 나라는괴물을막아봐 (#201) | Chessboard Nonogram (FXCUP4_nonogram) | C++17 | 7 ms | 640 KiB |
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"
#include<vector>
#include<algorithm>
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) {
int i, j;
vector<vector<int>>w(N);
for (i = 0; i < N; i++) {
w[i].resize(M);
for (j = 0; j < M; j++) {
if ((i + j) % 2 == 0)w[i][j] = 1;
}
}
for (i = 0; i < N; i += 2) {
vector<int>T = Rclue[i];
int c = 0, pv = 0;
for (j = 0; j < M; j++) {
if (w[i][j]) {
c++;
continue;
}
if (!w[i][j]) {
if (pv<T.size() && T[pv] > c) {
w[i][j] = 1;
c++;
}
else {
c = 0;
pv++;
}
}
}
}
for (i = 0; i < M; i += 2) {
vector<int>T = Cclue[i];
int c = 0, pv = 0;
for (j = 0; j < N; j++) {
if (w[j][i]) {
c++;
continue;
}
if (!w[j][i]) {
if (pv<T.size() && T[pv] > c) {
w[j][i] = 1;
c++;
}
else {
c = 0;
pv++;
}
}
}
}
return w;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |