Submission #67151

# Submission time Handle Problem Language Result Execution time Memory
67151 2018-08-13T11:59:40 Z quoriess Hidden Sequence (info1cup18_hidden) C++14
0 / 100
8 ms 436 KB
#include <bits/stdc++.h>
#include "grader.h"
/*
g++ -Wall -grader.cpp -std=c++11 -c "%f"
 * */
using namespace std;
vector<int> mult(int a,int x){
	vector<int> ret;
	for (int i = 0; i < x; i++)
	{
		ret.push_back(a);
	}
	return ret;
}
void yazdir(vector<int> yazi){
	for (int i = 0; i < (int)yazi.size(); i++)
	{
		cout << yazi[i];
	}
	cout <<"\n";
}
vector < int > findSequence (int N)
{
    vector < int > ans (N, 0);
    int no0=0;
    for (int i = 0; i <= N/2; i++)
	{
		if(isSubsequence(mult(0,i)))no0++;
		else break;
	}
	//cout << "no 0: "<<no0<<"\n";

	int fazla=0,az=1;
	if(N-no0>=no0){
		swap(fazla,az);
		no0=N-no0;
	}
	//cout << "fazla: "<<fazla<<"\n";
	//cout << "no 0: "<<no0<<"\n";
	//cout << "geldi"<<"\n";
	vector<int> templ=mult(fazla,no0);
	//son fazlayı çıkarttı
	int boslukind=no0;
	//cout << boslukind<<"\n";
	while(boslukind>=0 && (int)templ.size() < N){
		vector<int> cpy=templ;		
		//yazdir(templ);
		
		cpy.insert(cpy.begin()+boslukind,az);		
		//yazdir(cpy);
		
		if(isSubsequence(cpy)){
			//cout << "ss\n";
			templ.insert(templ.begin()+boslukind,az);
		}
		else{
			//cout << "?"<<"\n";
			boslukind--;
			continue;
		}
	}
	vector<int> trueans;
	for (int i = 0; i < N; i++)
	{
		if(templ[i]!=1904)trueans.push_back(templ[i]);
	}
	
    return trueans;
}

Compilation message

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++)
                   ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output is not correct: The returned sequence does not match the hidden one
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 436 KB Output is not correct: The returned sequence does not match the hidden one
2 Halted 0 ms 0 KB -