#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 isSequence(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
hidden.cpp: In function 'long long int query(long long int, long long int, long long int)':
hidden.cpp:32:9: error: 'isSequence' was not declared in this scope; did you mean 'findSequence'?
32 | return isSequence(v);
| ^~~~~~~~~~
| findSequence
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++)
| ~^~~~~~~~~~~~