Submission #148302

# Submission time Handle Problem Language Result Execution time Memory
148302 2019-08-31T23:25:15 Z mahmoudbadawy(#3737, mahmoudbadawy) Chessboard Nonogram (FXCUP4_nonogram) C++17
100 / 100
6 ms 512 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> > v(n,vector<int>(m,0));
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			v[i][j]=((i+j)%2==0?1:0);
	for(int i=0;i<n;i+=2)
	{
		int cur=0;
		for(int j=0;j<Rclue[i].size();j++)
		{
			//cout << i << ": " << Rclue[i][j] << endl;
			int en=cur+Rclue[i][j];
			for(;cur<en;cur++)
				v[i][cur]=1;
			cur++;
		}
		//cout << endl;
	}
	for(int i=0;i<m;i+=2)
	{
		int cur=0;
		for(int j=0;j<Cclue[i].size();j++)
		{
			int en=cur+Cclue[i][j];
			for(;cur<en;cur++)
				v[cur][i]=1;
			cur++;
		}
	}
	return v;
}

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:15:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<Rclue[i].size();j++)
               ~^~~~~~~~~~~~~~~~
nonogram.cpp:28:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<Cclue[i].size();j++)
               ~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 512 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 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 512 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 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 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 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 512 KB Output is correct
13 Correct 6 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 6 ms 512 KB Output is correct