# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
830229 | Edu175 | Counting Mushrooms (IOI20_mushrooms) | C++17 | 8 ms | 432 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>
#define pb push_back
#define fst first
#define snd second
#define fore(i,a,b) for(ll i=a,ioi=b;i<ioi;i++)
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define mset(a,v) memset((a),(v),sizeof(a))
#define imp(v) for(auto dfh:v)cout<<dfh<<" ";cout<<"\n"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
const ll MAXN=2e4+5;
ll ask(vector<ll>a){
vector<int>ai;
for(auto i:a)ai.pb(i);
return use_machine(ai);
}
const ll B=120;
int count_mushrooms(int N){
ll n=N;
vector<ll>a[2];
a[0]={0};
ll w=2,p=n;
fore(i,1,n){
if(SZ(a[0])==B){
w=0; p=i;
break;
}
if(SZ(a[1])==B){
w=1; p=i;
break;
}
if(ask({0,i}))a[1].pb(i);
else a[0].pb(i);
}
ll res=SZ(a[0]);
for(ll i=p;i<n;i+=SZ(a[w])){
vector<ll>v;
ll k=0;
fore(j,i,min(n,i+SZ(a[w]))){
v.pb(j); k++;
v.pb(a[w][j-i]);
}
ll resi=(ask(v)+1)/2;
if(w==0)resi=k-resi;
res+=resi;
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |