Submission #147666

# Submission time Handle Problem Language Result Execution time Memory
147666 2019-08-30T11:30:28 Z 몰랑이(#3643, cki86201) Chessboard Nonogram (FXCUP4_nonogram) C++17
100 / 100
6 ms 640 KB
#include <bits/stdc++.h>
#include "nonogram.h"

using namespace std;

#define Fi first
#define Se second
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<(n);i++)
typedef tuple<int, int, int> t3;
typedef tuple<int, int, int, int> t4;

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;
	ans.resize(N); rep(i, N) ans[i].resize(M);
	rep(i, N) rep(j, M) if((i+j)%2 == 0) ans[i][j] = 1;
	for(int i=0;i<N;i++) if(i % 2 == 0) {
			for(int j=0, k=0;j<M;j++) {
				if(k == szz(Rclue[i])) continue;
				if((i+j) % 2 == 0) Rclue[i][k]--;
				else {
					if(Rclue[i][k] == 0) ++k;
					else Rclue[i][k]--, ans[i][j] = 1;
				}
			}
		}
	for(int i=0;i<M;i++) if(i % 2 == 0) {
			for(int j=0, k=0;j<N;j++) {
				if(k == szz(Cclue[i])) continue;
				if((i+j) % 2 == 0) Cclue[i][k]--;
				else {
					if(Cclue[i][k] == 0) ++k;
					else Cclue[i][k]--, ans[j][i] = 1;
				}
			}
		}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 6 ms 408 KB Output is correct
8 Correct 6 ms 512 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 6 ms 512 KB Output is correct
11 Correct 6 ms 512 KB Output is correct
12 Correct 6 ms 640 KB Output is correct
13 Correct 6 ms 640 KB Output is correct
14 Correct 6 ms 600 KB Output is correct
15 Correct 6 ms 512 KB Output is correct