#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long long int lll;
long long int fibb[1100];
void Send_X(ll x)
{
ll i;
for(i=0;i<20;i++)
{
Send(x%2);
x/=2;
}
}
void sans(vector<ll> v)
{
ll i;
long long int s=0;
for(i=0;i<63;i++)
{
s+=lll(v[i])*fibb[i];
}
for(i=0;i<44;i++)
{
Send(s%2);
s/=2;
}
}
ll a[220000];
vector<ll> fib;
void Anna(ll N,vector<char> S) {
fibb[0]=1;
fibb[1]=2;
ll i,j;
for(i=2;i<=63;i++)
{
fibb[i]=fibb[i-1]+fibb[i-2];
}
ll n,x=0,z=N+1;
n=N;
for(i=n-1;i>=0;i--)
{
if(S[i]=='X')
{
x=i;
}
}
for(i=0;i<n;i++)
{
if(S[i]=='Z')
z=i;
}
for(i=0;i<n;i++)
{
if(i==n&&S[i]=='Z')
{
a[i]=1;
}
if(i<n)
{
if(S[i]=='Z'&&S[i+1]!='Z')
{
a[i]=1;
}
}
}
Send_X(x);
for(i=0;i<100000;i+=63)
{
fib.clear();
for(j=i;j<i+63;j++)
{
fib.push_back(a[j]);
}
/*if(i==0)
{
for(j=0;j<63;j++)
printf("%lld ",fib[j]);
printf("\n");
}
*/
sans(fib);
}
return;
}
#include "Bruno.h"
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long long int lll;
vector<ll> v;
deque<ll> stk;
ll b[220000];
long long int fibbb[1100];
ll inv_X()
{
ll i;
ll s=0;
for(i=19;i>=0;i--)
{
// printf("%d,",v[i]);
s=s*2+v[i];
}
return s;
}
lll decode(ll x,ll y)
{
lll i,s=0;
for(i=y;i>=x;i--)
{
s=s*2+v[i];
}
return s;
}
void Fill(ll x,ll y,long long int z)
{
long long int s=z;
ll i;
for(i=y;i>=x;i--)
{
if(s>=fibbb[62-y+i])
{b[i]=1;
s-=fibbb[62-y+i];
}
}
}
void Bruno(int N, int L,vector<int> A) {
fibbb[0]=1;
fibbb[1]=2;
ll i;
for(i=2;i<=63;i++)
{
fibbb[i]=fibbb[i-1]+fibbb[i-2];
}
lll t=0;
ll n,j,x,y,z;
// printf("[%d]\n",L);
n=N;
v.clear();
v.resize(L);
for(i=0;i<L;i++)
v[i]=A[i];
z=inv_X();
x=z;
//printf("%d\n",y);
//b[y]=1;
// printf("%d\n",z);
for(i=0;i<x;i++)
Remove(i);
i=20;
j=0;
while(1)
{
if(j>=n)
break;
t=decode(i,i+43);
/* if(i==20)
printf("%lld\n",t);
*/ Fill(j,j+62,t);
i+=44;
j+=63;
}
//stk.push_back(x);
for(i=z;i<n;i++)
{
//printf("%d\n",i);
if(b[i]==0)
{
stk.push_back(i);
continue;
}
else
{
while(stk.size()>=2)
{
x=stk.back();
Remove(x);
stk.pop_back();
}
Remove(i);
continue;
}
}
/* printf("\n");
for(i=0;i<n;i++)
printf("%d ",b[i]);
printf("\n");
*/while(stk.size()>=1)
{
x=stk.back();
//printf("%d\n",x);
Remove(x);
stk.pop_back();
}
}
Compilation message
Anna.cpp: In function 'void Send_X(ll)':
Anna.cpp:11:9: error: 'Send' was not declared in this scope; did you mean 'Send_X'?
11 | Send(x%2);
| ^~~~
| Send_X
Anna.cpp: In function 'void sans(std::vector<int>)':
Anna.cpp:26:9: error: 'Send' was not declared in this scope; did you mean 'Send_X'?
26 | Send(s%2);
| ^~~~
| Send_X
Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:51:14: warning: unused variable 'y' [-Wunused-variable]
51 | ll n,j,x,y,z;
| ^