Submission #67123

# Submission time Handle Problem Language Result Execution time Memory
67123 2018-08-13T11:00:23 Z ege_eksi Hidden Sequence (info1cup18_hidden) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "grader.h"

using namespace std;

vector<int> S;

bool generateAll(int n)
{
	if(S.size() == n)
	{
		if(isSubsequence(S) == true)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	
	S.push_back(0);
	
	if(generateAll(S) == true)
	{
		return true;
	}
	
	S.pop_back();
	
	S.push_back(1);
	
	if(generateAll(S) == true)
	{
		return true;
	}
	
	S.pop_back();
	
	return false;
}

vector < int > findSequence (int N)
{
	generateAll(N);
	
	return S;
}

Compilation message

hidden.cpp: In function 'bool generateAll(int)':
hidden.cpp:10:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(S.size() == n)
     ~~~~~~~~~^~~~
hidden.cpp:24:18: error: cannot convert 'std::vector<int>' to 'int' for argument '1' to 'bool generateAll(int)'
  if(generateAll(S) == true)
                  ^
hidden.cpp:33:18: error: cannot convert 'std::vector<int>' to 'int' for argument '1' to 'bool generateAll(int)'
  if(generateAll(S) == true)
                  ^
grader.cpp: In function 'int main()':
grader.cpp:28:43: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
     fprintf (fifo_out, "%d\n", ans.size ());
                                ~~~~~~~~~~~^
grader.cpp:29:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0; i<ans.size () && i < N; i++)
                   ~^~~~~~~~~~~~