답안 #148170

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148170 2019-08-31T16:31:37 Z ksun48(#3707, ksun48) 체스판 네모네모로직 (FXCUP4_nonogram) C++17
100 / 100
7 ms 640 KB
#include "nonogram.h"
#include <bits/stdc++.h>

std::vector<std::vector<int>> SolveNonogram(int N, int M, 
	std::vector<std::vector<int>> Rclue, std::vector<std::vector<int>> Cclue) {
	using namespace std;

	int n = N;
	int m = M;
	auto rclue = Rclue;
	auto cclue = Cclue;
	vector<vector<int> > ans(n, vector<int>(m, 0));
	for(int i = 0; i < n; i += 1){
		for(int j = 0; j < m; j++){
			if(((i + j) & 1) == 0) ans[i][j] = 1;
		}
	}
	for(int i = 0; i < n; i += 2){
		vector<int> clue = rclue[i];
		int cur = 0;
		for(int x : clue){
			for(int j = 0; j < x; j++){
				ans[i][cur] = 1;
				cur += 1;
			}
			cur += 1;
		}
		assert(cur >= m);
	}
	for(int i = 0; i < m; i += 2){
		vector<int> clue = cclue[i];
		int cur = 0;
		for(int x : clue){
			for(int j = 0; j < x; j++){
				ans[cur][i] = 1;
				cur += 1;
			}
			cur += 1;
		}
		assert(cur >= n);
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 6 ms 512 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 6 ms 384 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 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 6 ms 512 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 7 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 600 KB Output is correct
14 Correct 6 ms 512 KB Output is correct
15 Correct 6 ms 512 KB Output is correct