#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
512 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
512 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
512 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
512 KB |
Output is correct |
5 |
Correct |
6 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 |
6 ms |
384 KB |
Output is correct |
9 |
Correct |
6 ms |
384 KB |
Output is correct |
10 |
Correct |
7 ms |
512 KB |
Output is correct |
11 |
Correct |
7 ms |
512 KB |
Output is correct |
12 |
Correct |
6 ms |
512 KB |
Output is correct |
13 |
Correct |
6 ms |
600 KB |
Output is correct |
14 |
Correct |
7 ms |
640 KB |
Output is correct |
15 |
Correct |
7 ms |
592 KB |
Output is correct |