# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
147647 | 2019-08-30T10:56:22 Z | 함수컵 최고~(#3641, tlwpdus) | 체스판 네모네모로직 (FXCUP4_nonogram) | C++17 | 7 ms | 640 KB |
#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 += Cclue[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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 512 KB | Output is correct |
3 | Correct | 6 ms | 464 KB | Output is correct |
4 | Correct | 6 ms | 384 KB | Output is correct |
5 | Correct | 6 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 512 KB | Output is correct |
3 | Correct | 6 ms | 464 KB | Output is correct |
4 | Correct | 6 ms | 384 KB | Output is correct |
5 | Correct | 6 ms | 512 KB | Output is correct |
6 | Correct | 6 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 6 ms | 384 KB | Output is correct |
9 | Correct | 6 ms | 380 KB | Output is correct |
10 | Correct | 7 ms | 640 KB | Output is correct |
11 | Correct | 7 ms | 512 KB | Output is correct |
12 | Correct | 6 ms | 512 KB | Output is correct |
13 | Correct | 7 ms | 640 KB | Output is correct |
14 | Correct | 7 ms | 512 KB | Output is correct |
15 | Correct | 7 ms | 512 KB | Output is correct |