Submission #352367

# Submission time Handle Problem Language Result Execution time Memory
352367 2021-01-20T16:31:45 Z Sho10 Hidden Sequence (info1cup18_hidden) C++17
100 / 100
9 ms 508 KB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#include "grader.h"
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define aint(a) (a).begin(), (a).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll query(ll x1,ll x2,ll val){
	vector<int>v;
	for(ll i=1;i<=x1;i++)
	{
		v.pb(val);
	}
	for(ll i=1;i<=x2;i++)
	{
		v.pb((val^1));
	}
	return isSubsequence(v);
}
vector<int> findSequence(int N){
	ll n=N,cnt0=0,cnt1=0;
	for(ll i=1;i<=n;i++){
	if(!query(i,0,0)){
		cnt0=i-1;
		cnt1=n-cnt0;
		break;
	}
	if(!query(i,0,1)){
		cnt1=i-1;
		cnt0=n-cnt1;
		break;
	}
}
ll l0=0,l1=0,r0=cnt0,r1=cnt1;
vector<int>ans;
for(ll i=1;i<=n;i++)
{
	ll res;
	if(l0+r1+1<=n/2+1){
		if(query(l0+1,r1,0)){
			res=0;
		}else res=1;
	}else {
		if(query(l1+1,r0,1)){
			res=1;
		}else res=0;
	}
	if(res){
		l1++;
		r1--;
	}else {
		l0++;
		r0--;
	}
	ans.pb(res);
}
return ans;
}
/*
int32_t main(){
CODE_START;
*/

Compilation message

grader.cpp: In function 'int main()':
grader.cpp:28:26: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   28 |     fprintf (fifo_out, "%d\n", ans.size ());
      |                         ~^     ~~~~~~~~~~~
      |                          |              |
      |                          int            std::vector<int>::size_type {aka long unsigned int}
      |                         %ld
grader.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for (int i=0; i<ans.size () && i < N; i++)
      |                   ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct: Maximum length of a query = 5
2 Correct 1 ms 364 KB Output is correct: Maximum length of a query = 6
3 Correct 1 ms 364 KB Output is correct: Maximum length of a query = 5
4 Correct 1 ms 364 KB Output is correct: Maximum length of a query = 5
5 Correct 1 ms 364 KB Output is correct: Maximum length of a query = 4
# Verdict Execution time Memory Grader output
1 Correct 7 ms 364 KB Output is correct: Maximum length of a query = 83
2 Correct 6 ms 376 KB Output is correct: Maximum length of a query = 90
3 Correct 7 ms 508 KB Output is correct: Maximum length of a query = 96
4 Correct 5 ms 364 KB Output is correct: Maximum length of a query = 77
5 Correct 7 ms 364 KB Output is correct: Maximum length of a query = 95
6 Correct 6 ms 364 KB Output is correct: Maximum length of a query = 87
7 Correct 9 ms 376 KB Output is correct: Maximum length of a query = 97
8 Correct 7 ms 364 KB Output is correct: Maximum length of a query = 83
9 Correct 9 ms 364 KB Output is correct: Maximum length of a query = 101
10 Correct 9 ms 364 KB Output is correct: Maximum length of a query = 100
11 Correct 9 ms 364 KB Output is correct: Maximum length of a query = 96
12 Correct 7 ms 364 KB Output is correct: Maximum length of a query = 100
13 Correct 9 ms 364 KB Output is correct: Maximum length of a query = 101