# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
885240 | epicci23 | Counting Mushrooms (IOI20_mushrooms) | C++17 | 6 ms | 700 KiB |
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 "mushrooms.h"
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define pb push_back
#define sz(x) ((int)(x).size())
const int BL = 100;
int count_mushrooms(int n){
int ans=1;
vector<int> ind_a,ind_b;
ind_a.pb(0);
for(int i=1;i<=min(n-1,2*BL+1);i++){
int xd = use_machine({0,i});
if(xd==0){
ans++;
ind_a.pb(i);
}
else{
ind_b.pb(i);
}
}
if(n-1<=2*BL+1) return ans;
for(int i=2*BL+2;i<n;i+=BL){
vector<int> que;
for(int j=i;j<min(n,i+BL);j++) que.pb(j);
if(sz(ind_a)>sz(que)){
vector<int> haha;
haha.pb(ind_a[0]);
for(int j=0;j<sz(que);j++){
haha.pb(que[j]);
haha.pb(ind_a[j+1]);
}
int res = use_machine(haha);
ans += sz(que) - res/2;
}
else{
vector<int> haha;
haha.pb(ind_b[0]);
for(int j=0;j<sz(que);j++){
haha.pb(que[j]);
haha.pb(ind_b[j+1]);
}
int res = use_machine(haha);
ans += res/2;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |