Submission #81584

# Submission time Handle Problem Language Result Execution time Memory
81584 2018-10-25T12:38:09 Z farukkastamonuda Hidden Sequence (info1cup18_hidden) C++14
100 / 100
11 ms 692 KB
#include "grader.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define lo long long 
#define inf 1000000009
#define md 1000000007
#define li 500005
#define mp make_pair
#define pb push_back
using namespace std;
int i,h,k;
vector<int> u,ans;
vector<int> findSequence(int n){
	for(i=0;i<=n/2;i++){
		u.pb(1);
		if(isSubsequence(u)==0) break;
	}
	if(i<=n/2){
		h=1;
		k=i;
		u.pop_back();
	}
	else{
		h=0;
		u.clear();
		for(k=0; ;k++){
			u.pb(0);
			if(isSubsequence(u)==0) break;
		}
		u.pop_back();
	}
	int kk=n-k;
	int t=0,tt=0;
	for(int j=0;j<n;j++){
		vector<int> v;
		if(k+tt<kk+t){
			for(int i=1;i<=tt+1;i++) v.pb(!h);
			for(int i=1;i<=k;i++) v.pb(h);
			if(isSubsequence(v)){ans.pb(!h);tt++;kk--;}
			else {ans.pb(h);t++;k--;}
		}
		else{
			for(int i=1;i<=t+1;i++) v.pb(h);
			for(int i=1;i<=kk;i++) v.pb(!h);
			if(isSubsequence(v)){ans.pb(h);t++;k--;}
			else{ans.pb(!h);tt++;kk--;}
		}
	}
	return ans;
}

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 Correct 2 ms 248 KB Output is correct: Maximum length of a query = 5
2 Correct 2 ms 324 KB Output is correct: Maximum length of a query = 6
3 Correct 2 ms 528 KB Output is correct: Maximum length of a query = 5
4 Correct 2 ms 528 KB Output is correct: Maximum length of a query = 5
5 Correct 2 ms 528 KB Output is correct: Maximum length of a query = 4
# Verdict Execution time Memory Grader output
1 Correct 6 ms 528 KB Output is correct: Maximum length of a query = 83
2 Correct 6 ms 528 KB Output is correct: Maximum length of a query = 90
3 Correct 6 ms 528 KB Output is correct: Maximum length of a query = 96
4 Correct 5 ms 528 KB Output is correct: Maximum length of a query = 77
5 Correct 6 ms 664 KB Output is correct: Maximum length of a query = 95
6 Correct 5 ms 664 KB Output is correct: Maximum length of a query = 87
7 Correct 11 ms 664 KB Output is correct: Maximum length of a query = 97
8 Correct 6 ms 664 KB Output is correct: Maximum length of a query = 83
9 Correct 7 ms 664 KB Output is correct: Maximum length of a query = 101
10 Correct 8 ms 692 KB Output is correct: Maximum length of a query = 100
11 Correct 6 ms 692 KB Output is correct: Maximum length of a query = 96
12 Correct 6 ms 692 KB Output is correct: Maximum length of a query = 100
13 Correct 8 ms 692 KB Output is correct: Maximum length of a query = 101