Submission #148041

# Submission time Handle Problem Language Result Execution time Memory
148041 2019-08-31T12:04:33 Z .(#3664, khsoo01) Chessboard Nonogram (FXCUP4_nonogram) C++17
100 / 100
6 ms 640 KB
#include "nonogram.h"
using namespace std;

vector<vector<int>> SolveNonogram(int N, int M, vector<vector<int>> Rclue, vector<vector<int>> Cclue) {
	vector<vector<int> > R;
	for(int i=0;i<N;i++) {
		vector<int> T;
		for(int j=0;j<M;j++) {
			T.push_back(0);
		}
		R.push_back(T);
	}
	for(int i=0,j=0;i<Cclue[0].size();i++) {
		for(int k=0;k<Cclue[0][i];k++) {
			R[j++][0] = 1;
		}
		j++;
	}
	for(int i=0;i<Rclue.size();i++) {
		int j = (R[i][0] ? 0 : 1);
		for(int k1=0;k1<Rclue[i].size();k1++) {
			for(int k2=0;k2<Rclue[i][k1];k2++) {
				R[i][j++] = 1;
			}
			j++;
		}
	}
	return R;
}

Compilation message

nonogram.cpp: In function 'std::vector<std::vector<int> > SolveNonogram(int, int, std::vector<std::vector<int> >, std::vector<std::vector<int> >)':
nonogram.cpp:13:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0,j=0;i<Cclue[0].size();i++) {
                  ~^~~~~~~~~~~~~~~~
nonogram.cpp:19:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<Rclue.size();i++) {
              ~^~~~~~~~~~~~~
nonogram.cpp:21:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int k1=0;k1<Rclue[i].size();k1++) {
                ~~^~~~~~~~~~~~~~~~
# 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 6 ms 384 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 6 ms 384 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 6 ms 512 KB Output is correct
11 Correct 6 ms 640 KB Output is correct
12 Correct 6 ms 512 KB Output is correct
13 Correct 6 ms 512 KB Output is correct
14 Correct 6 ms 512 KB Output is correct
15 Correct 6 ms 512 KB Output is correct