Submission #148345

#TimeUsernameProblemLanguageResultExecution timeMemory
148345JeffreyHo (#201)Chessboard Nonogram (FXCUP4_nonogram)C++17
100 / 100
6 ms512 KiB
#include "nonogram.h" using namespace std; std::vector<std::vector<int>> SolveNonogram(int n, int m, std::vector<std::vector<int>> r, std::vector<std::vector<int>> c) { vector<vector<int>> z(n); for (int i = 0; i < n; i++) z[i].resize(m); for (int i = 0; i < n; i++) { if (r[i][0] == m - 1) { for (int j = 1; j + 1 < m; j++) z[i][j] = 1; } else { int d = i % 2; if (i % 2 && r[i][0] % 2 == 0) r[i][0]--, z[i][0] = 1; for (int j : r[i]) { while (j--) z[i][d++] = 1; d++; } } } int d = 0; for (int j : c[0]) { while (j--) { z[d][0] = 1; d++; } if (d < n && r[d][0] == m - 1) z[d][m - 1] = 1; d++; } return z; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...