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