#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for(int i=0; i<n; ++i)
int la, ra, rq;
void InitA(int n, int l, int r) {
la = l, ra = r;
forn(i,14) SendA((l>>i)&1);
forn(i,4) SendA((r>>(i+10))&1);
rq=(r>>10)<<10;
rq=max(rq,la);
}
int ai=-1;
int mn = -1;
void ReceiveA(bool x) {
int b=x;
if (ai==-1) {
if (b) ++ai, mn=0;
else ai=14;
return;
}
if (ai<14) {
mn+=b<<ai; ++ai; return;
}
if (rq+ai-14 > ra) return;
if (b) mn = rq+ai-14;
++ai;
}
int Answer() {
return mn;
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for(int i=0; i<n; ++i)
const int N=1e6+5;
int a[N];
int n;
void InitB(int n, vector<int> a) {
forn(i,n) ::a[i]=a[i];
::n=n;
}
int lq=0,rq=0;
int bi=0;
void ReceiveB(bool b) {
int x = b;
if (bi<14) {
lq+=x<<bi;
} else if (bi<18) {
rq+=x<<(bi-4);
}
++bi;
if (bi==18) {
int mn=lq;
for(int i=lq; i<rq; ++i) {
if (mn==-1) mn=i;
if (a[i]<a[mn]) mn=i;
}
if (mn==-1) {
SendB(0);
} else {
SendB(1);
forn(i,14) SendB((mn>>i)&1);
}
for(int i=max(rq,lq); i<=rq+1024; ++i) {
if (mn==-1) mn=i;
if (a[i]<a[mn]) mn=i;
SendB(mn==i);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
664 KB |
Output is correct |
2 |
Correct |
8 ms |
664 KB |
Output is correct |
3 |
Correct |
6 ms |
664 KB |
Output is correct |
4 |
Correct |
6 ms |
664 KB |
Output is correct |
5 |
Correct |
6 ms |
664 KB |
Output is correct |
6 |
Correct |
6 ms |
664 KB |
Output is correct |
7 |
Correct |
5 ms |
664 KB |
Output is correct |
8 |
Correct |
4 ms |
664 KB |
Output is correct |
9 |
Correct |
2 ms |
664 KB |
Output is correct |
10 |
Correct |
6 ms |
664 KB |
Output is correct |
11 |
Correct |
3 ms |
664 KB |
Output is correct |
12 |
Correct |
4 ms |
664 KB |
Output is correct |
13 |
Correct |
4 ms |
664 KB |
Output is correct |
14 |
Correct |
5 ms |
664 KB |
Output is correct |
15 |
Correct |
4 ms |
664 KB |
Output is correct |
16 |
Correct |
6 ms |
664 KB |
Output is correct |
17 |
Correct |
6 ms |
664 KB |
Output is correct |
18 |
Correct |
4 ms |
664 KB |
Output is correct |
19 |
Correct |
4 ms |
664 KB |
Output is correct |
20 |
Correct |
5 ms |
664 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
664 KB |
Output is correct |
2 |
Correct |
8 ms |
664 KB |
Output is correct |
3 |
Correct |
6 ms |
664 KB |
Output is correct |
4 |
Correct |
6 ms |
664 KB |
Output is correct |
5 |
Correct |
6 ms |
664 KB |
Output is correct |
6 |
Correct |
6 ms |
664 KB |
Output is correct |
7 |
Correct |
5 ms |
664 KB |
Output is correct |
8 |
Correct |
4 ms |
664 KB |
Output is correct |
9 |
Correct |
2 ms |
664 KB |
Output is correct |
10 |
Correct |
6 ms |
664 KB |
Output is correct |
11 |
Correct |
3 ms |
664 KB |
Output is correct |
12 |
Correct |
4 ms |
664 KB |
Output is correct |
13 |
Correct |
4 ms |
664 KB |
Output is correct |
14 |
Correct |
5 ms |
664 KB |
Output is correct |
15 |
Correct |
4 ms |
664 KB |
Output is correct |
16 |
Correct |
6 ms |
664 KB |
Output is correct |
17 |
Correct |
6 ms |
664 KB |
Output is correct |
18 |
Correct |
4 ms |
664 KB |
Output is correct |
19 |
Correct |
4 ms |
664 KB |
Output is correct |
20 |
Correct |
5 ms |
664 KB |
Output is correct |
21 |
Correct |
4 ms |
664 KB |
Output is correct |
22 |
Correct |
6 ms |
664 KB |
Output is correct |
23 |
Correct |
6 ms |
664 KB |
Output is correct |
24 |
Correct |
6 ms |
664 KB |
Output is correct |
25 |
Correct |
4 ms |
664 KB |
Output is correct |
26 |
Correct |
4 ms |
664 KB |
Output is correct |
27 |
Correct |
6 ms |
664 KB |
Output is correct |
28 |
Correct |
6 ms |
664 KB |
Output is correct |
29 |
Correct |
6 ms |
664 KB |
Output is correct |
30 |
Correct |
3 ms |
664 KB |
Output is correct |
31 |
Correct |
6 ms |
664 KB |
Output is correct |
32 |
Correct |
6 ms |
664 KB |
Output is correct |
33 |
Correct |
4 ms |
664 KB |
Output is correct |
34 |
Correct |
2 ms |
664 KB |
Output is correct |
35 |
Correct |
5 ms |
664 KB |
Output is correct |
36 |
Correct |
6 ms |
664 KB |
Output is correct |
37 |
Correct |
3 ms |
664 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |