Submission #147745

#TimeUsernameProblemLanguageResultExecution timeMemory
147745min cho (#201)Chessboard Nonogram (FXCUP4_nonogram)C++17
100 / 100
7 ms512 KiB
#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>> Rclue, std::vector<std::vector<int>> Cclue) { vector<vector<int>> v(N); for(auto &i : v) i.resize(M); for(int i=0; i<N; i++){ for(int j=0; j<M; j++){ v[i][j] = (i + j + 1) % 2; } } int ptr = 0; for(auto &i : Rclue[0]){ for(int j=ptr; j<ptr+i; j++) v[0][j] = 1; ptr += i + 1; } for(int i=0; i<M; i++){ int ptr = 0; if(!v[0][i]) ptr++; for(auto &j : Cclue[i]){ for(int k=ptr; k<ptr+j; k++) v[k][i] = 1; ptr += j + 1; } } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...