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 <bits/stdc++.h>
std::vector<std::vector<int>> SolveNonogram(int N, int M,
std::vector<std::vector<int>> Rclue, std::vector<std::vector<int>> Cclue) {
using namespace std;
int n = N;
int m = M;
auto rclue = Rclue;
auto cclue = Cclue;
vector<vector<int> > ans(n, vector<int>(m, 0));
for(int i = 0; i < n; i += 1){
for(int j = 0; j < m; j++){
if(((i + j) & 1) == 0) ans[i][j] = 1;
}
}
for(int i = 0; i < n; i += 2){
vector<int> clue = rclue[i];
int cur = 0;
for(int x : clue){
for(int j = 0; j < x; j++){
ans[i][cur] = 1;
cur += 1;
}
cur += 1;
}
assert(cur >= m);
}
for(int i = 0; i < m; i += 2){
vector<int> clue = cclue[i];
int cur = 0;
for(int x : clue){
for(int j = 0; j < x; j++){
ans[cur][i] = 1;
cur += 1;
}
cur += 1;
}
assert(cur >= n);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |