Submission #148170

#TimeUsernameProblemLanguageResultExecution timeMemory
148170ksun48 (#201)Chessboard Nonogram (FXCUP4_nonogram)C++17
100 / 100
7 ms640 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...