| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1157712 | arkanefury | Shopping (JOI21_shopping) | C++20 | 0 ms | 0 KiB |
#include "Anna.h"
#include <vector>
namespace {
int N, L, R;
int count = 0, ans = 0;
} // namespace
void InitA(int N, int L, int R) {
::N = N;
::L = L;
::R = R;
int a[105];
for(int i = 0; i < 18; i ++){
a[i] = (L >> i) & 1);
sendA(a[i]);
}
for(int i = 0; i < 18; i ++){
if((R >> i & 1) != (L >> i & 1) && !a[i])sendA(1);
else if((R >> i & 1) != (L >> i & 1) && a[i])sendA(1);
else sendA(0);
}
}
void ReceiveA(bool x){
if(y)ans += (1 << count);
count ++;
}
int Answer() {
return ans;
}
#include "Bruno.h"
#include <vector>
namespace {
int N;
int variable_example[1000000];
int count;
bool FunctionExample(bool P) {
return !P;
}
} // namespace
void InitB(int N, std::vector<int> P) {
::N = N;
for(int i = 0; i < N; i++){
variable_example[i] = P[i];
}
count = 0;
}
void ReceiveB(bool y){
int L = 0, R = 0;
if(count < 18){
if(y)L += (1 << count);
}
int pl = 0;
else{
if(y)R += (1 << (count - 18));
pl ++;
}
if(pl == 18){
ans = 1e18;
FOR(i, L, R, 1)ans = min(ans, variable_example[i]);
FOR(i, 0, 20, 1)sendB(ans >> i & 1);
}
count++;
}
