Submission #147936

#TimeUsernameProblemLanguageResultExecution timeMemory
147936pichulia,koosaga,ainta (#201)Chessboard Nonogram (FXCUP4_nonogram)C++17
100 / 100
7 ms640 KiB
#include "nonogram.h" std::vector<std::vector<int>> SolveNonogram(int n, int m, std::vector<std::vector<int>> Rclue, std::vector<std::vector<int>> Cclue) { std::vector<std::vector<int> > a(n); int i, j, k; for (i = 0; i < n; i++) { a[i].resize(m); for (j = 0; j < m; j++) { if((i&1)^(j&1)) a[i][j] = 0; else a[i][j] = 1; } } // update for (i = 0; i < n; i++) { if (i & 1) { } else { k = 0; int cnt = 0; for (j = 0; j < m; j++) { if (a[i][j] == 1) { cnt++; continue; } if (k < Rclue[i].size() && Rclue[i][k] == cnt) { a[i][j] = 0; k++; cnt = 0; } else { a[i][j] = 1; cnt++; } } } } for (j = 0; j < m; j++) { if (j & 1) { } else { k = 0; int cnt = 0; for (i = 0; i < n; i++) { if (a[i][j] == 1) { cnt++; continue; } if (k < Cclue[j].size() && Cclue[j][k] == cnt) { a[i][j] = 0; k++; cnt = 0; } else { a[i][j] = 1; cnt++; } } } } return a; }

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:26:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (k < Rclue[i].size() && Rclue[i][k] == cnt) {
         ~~^~~~~~~~~~~~~~~~~
nonogram.cpp:47:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (k < Cclue[j].size() && Cclue[j][k] == cnt) {
         ~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...