#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 + 1);
}
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 + 1);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
6 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
6 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |