Submission #147646

#TimeUsernameProblemLanguageResultExecution timeMemory
147646함수컵 최고~ (#201)Chessboard Nonogram (FXCUP4_nonogram)C++17
0 / 100
7 ms384 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>> ans(N,vector<int>(M,0)); if (M%2==0) { for (int i=0;i<N;i++) { int s = 0; for (int &v : Rclue[i]) s+=v; s += (int)Rclue[i].size()-1; int ti = 0; if (s==M-1&&i%2) ti = 1; for (int j=0;j<Rclue[i].size();j++){ for (int k=ti;k<ti+Rclue[i][j];k++) { ans[i][k] = 1; } ti += Rclue[i][j]+1; } } return ans; } if (N%2==0) { for (int i=0;i<M;i++) { int s = 0; for (int &v : Cclue[i]) s+=v; s += (int)Cclue[i].size()-1; int ti = 0; if (s==N-1&&i%2) ti = 1; for (int j=0;j<Cclue[i].size();j++){ for (int k=ti;k<ti+Cclue[i][j];k++) { ans[k][i] = 1; } ti += Cclue[i][j]+1; } } return ans; }for (int i=0;i<N;i+=2) { int s = 0; for (int &v : Rclue[i]) s+=v; s += (int)Rclue[i].size()-1; int ti = 0; if (s==M-1&&i%2) ti = 1; for (int j=0;j<Rclue[i].size();j++){ for (int k=ti;k<ti+Rclue[i][j];k++) { ans[i][k] = 1; } ti += Rclue[i][j]+1; } } for (int i=0;i<M;i+=2) { int s = 0; for (int &v : Cclue[i]) s+=v; s += (int)Cclue[i].size()-1; int ti = 0; if (s==N-1&&i%2) ti = 1; for (int j=0;j<Cclue[i].size();j++){ for (int k=ti;k<ti+Cclue[i][j];k++) { ans[k][i] = 1; } ti += Rclue[i][j]+1; } } for (int i=1;i<N;i+=2) { for (int j=1;j<M;j+=2) { ans[i][j] = 1; } } return ans; }

Compilation message (stderr)

nonogram.cpp: In function 'std::vector<std::vector<int> > SolveNonogram(int, int, std::vector<std::vector<int> >, std::vector<std::vector<int> >)':
nonogram.cpp:15:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int j=0;j<Rclue[i].size();j++){
                          ~^~~~~~~~~~~~~~~~
nonogram.cpp:31:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int j=0;j<Cclue[i].size();j++){
                          ~^~~~~~~~~~~~~~~~
nonogram.cpp:45:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int j=0;j<Rclue[i].size();j++){
                          ~^~~~~~~~~~~~~~~~
nonogram.cpp:58:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int j=0;j<Cclue[i].size();j++){
                          ~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...