This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Anna.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
namespace {
int n, l, r;
int c,o;
} // namespace
vector <long long > v;
void InitA(int N, int L, int R) {
n= N;
l= L;
r= R;
int a=r-l;
for (int i=0;i<18;i++)
{
SendA(a%2);
a/=2;
}
}
void ReceiveA(bool x)
{
o+=(1<<c)*int(x);
c++;
if (c==20)
{
c=0;
v.push_back(o);
o=0;
}
}
int Answer() {
v.push_back(n+5);
for (int i=0;i<v.size();i++)
{
if (v[i]==v[i+1])
{
if (v[i]>=l&&v[i]<=r)
{
return v[i];
}
i++;
}
else if (v[i]<=r&&v[i]>=l&&v[i+1]>r)
{
return v[i];
}
}
}
#include "Bruno.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
namespace {
int n;
int a[1000000];
int co,o,b,c;
}
void send(int y)
{
for (int i=0;i<20;i++)
{
SendB(y%2);
y/=2;
}
}
void InitB(int N, std::vector<int> P) {
n= N;
for(int i = 0; i < N; i++) {
a[i]= P[i];
}
}
void ReceiveB(bool y) {
o+=(1<<co)*int(y);
co++;
if (co==18)
{
for (int i=0;i<n;)
{
if (b==0)
{
b=a[i];
c=i;
for (int j=i+1;j-i<=o;j++)
{
if (a[j]<b)
{
b=a[j];
c=j;
}
}
send(c);
}
else
{
for (int j=i+1;j-i<=o;j++)
{
if (a[j]<b)
{
b=a[j];
c=j;
}
}
send (c);
if (c==i)
{
if (n-i-1<=o)return;
i++;
b=0;
}
else i=c;
}
}
}
}
Compilation message (stderr)
Anna.cpp: In function 'int Answer()':
Anna.cpp:41:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
41 | for (int i=0;i<v.size();i++)
| ~^~~~~~~~~
Anna.cpp:56:1: warning: control reaches end of non-void function [-Wreturn-type]
56 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |