#include "nonogram.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<std::vector<int>> SolveNonogram(int n, int m, std::vector<std::vector<int>> r, std::vector<std::vector<int>> c) {
vector<vector<int> > a(n);
vector <int> b;
for(int i = 0;i < n;i++)
{
int k = 0,cn;
if(i % 2 == 0)
{
for(int j : r[i])
{
for(cn = 0;cn < j;k++,cn++)
{
a[i].push_back(1);
}
if(k != m) a[i].push_back(0);
k++;
}
}
else
{
b.clear();
for(int j : c[0])
{
for(cn = 0;cn < j;k++,cn++)
{
b.push_back(1);
}
if(k != n) b.push_back(0);
k++;
}
//cout << b.size() << " ";
//cout << '\n';
if(!b[i]) a[i].push_back(0);
k = !b[i];
for(int j : r[i])
{
for(cn = 0;cn < j;k++,cn++)
{
a[i].push_back(1);
}
if(k != m) a[i].push_back(0);
k++;
}
}
}
return a;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
512 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
512 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
6 ms |
384 KB |
Output is correct |
11 |
Correct |
6 ms |
512 KB |
Output is correct |
12 |
Correct |
6 ms |
384 KB |
Output is correct |
13 |
Correct |
6 ms |
508 KB |
Output is correct |
14 |
Correct |
6 ms |
512 KB |
Output is correct |
15 |
Correct |
6 ms |
512 KB |
Output is correct |