# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1173257 | SmuggingSpun | Shopping (JOI21_shopping) | C++20 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
#include "Anna.h"
using namespace std;
int n, l, r, ans;
vector<bool>bit;
void InitA(int N, int L, int R){
l = L;
r = R;
if((n = N) <= 10000){
for(int i = 13; i > -1; i--){
SendA(l >> i & 1);
}
return;
}
}
void ReceiveA(bool x){
bit.emplace_back(x);
if(bit.size() == n - l){
for(int i = r - l; i > -1; i--){
if(bit[i]){
ans = i + l;
break;
}
}
}
}
int Answer(){
return ans;
}
#include<bits/stdc++.h>
#include "Bruno.h"
using namespace std;
int L = 0, cnt_receive = 0;
vector<int>a;
void InitB(int N, vector<int>P){
a = P;
}
void ReceiveB(bool y){
L = (L << 1) + int(y);
if(++cnt_receive == 14){
SendB(true);
for(int i = L + 1, min_i = L; i < n; i++){
if(a[i] < a[min_i]){
min_i = i;
SendB(true);
}
else{
SendB(false);
}
}
}
}