#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
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 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
448 KB |
Output is correct |
4 |
Correct |
3 ms |
404 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
7 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
8 ms |
384 KB |
Output is correct |
10 |
Incorrect |
1 ms |
192 KB |
Wrong Answer [4] |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
448 KB |
Output is correct |
4 |
Correct |
3 ms |
404 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
7 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
8 ms |
384 KB |
Output is correct |
10 |
Incorrect |
1 ms |
192 KB |
Wrong Answer [4] |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
156 ms |
12024 KB |
Output is correct |
2 |
Failed |
0 ms |
264 KB |
Unexpected end of file - int32 expected (Bruno) |
3 |
Halted |
0 ms |
0 KB |
- |