# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147936 | pichulia,koosaga,ainta (#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"
std::vector<std::vector<int>> SolveNonogram(int n, int m, std::vector<std::vector<int>> Rclue, std::vector<std::vector<int>> Cclue) {
std::vector<std::vector<int> > a(n);
int i, j, k;
for (i = 0; i < n; i++)
{
a[i].resize(m);
for (j = 0; j < m; j++) {
if((i&1)^(j&1))
a[i][j] = 0;
else
a[i][j] = 1;
}
}
// update
for (i = 0; i < n; i++) {
if (i & 1) {
}
else {
k = 0;
int cnt = 0;
for (j = 0; j < m; j++) {
if (a[i][j] == 1) { cnt++; continue; }
if (k < Rclue[i].size() && Rclue[i][k] == cnt) {
a[i][j] = 0;
k++;
cnt = 0;
}
else {
a[i][j] = 1;
cnt++;
}
}
}
}
for (j = 0; j < m; j++) {
if (j & 1) {
}
else {
k = 0;
int cnt = 0;
for (i = 0; i < n; i++) {
if (a[i][j] == 1) { cnt++; continue; }
if (k < Cclue[j].size() && Cclue[j][k] == cnt) {
a[i][j] = 0;
k++;
cnt = 0;
}
else {
a[i][j] = 1;
cnt++;
}
}
}
}
return a;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |