# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
436213 | Belgutei | Counting Mushrooms (IOI20_mushrooms) | C++17 | 5 ms | 200 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;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
int ans=1;
vector<int> v,v1;
int count_mushrooms(int n) {
v.pb(0);
for(int i=1; i<n && i<200; i++){
vector<int> tur;
tur.clear();
tur.pb(0);
tur.pb(i);
int val=use_machine(tur);
if(val==0) v.pb(i),ans++;
else v1.pb(i);
}
if(n<=200) return ans;
if(v.size()>v1.size()){
int i=200;
while(i<n){
vector<int> tur;
tur.clear();
int pos=0;
while(pos<v.size() && i<n){
tur.pb(v[pos]);
tur.pb(i);
i++;
pos++;
}
int val=use_machine(tur);
ans+=v.size()-(val+1)/2;
}
}
else{
int i=200;
while(i<n){
vector<int> tur;
tur.clear();
int pos=0;
while(pos<v1.size() && i<n){
tur.pb(v1[pos]);
tur.pb(i);
i++;
pos++;
}
int val=use_machine(tur);
ans+=(val+1)/2;
}
}
return ans;
//int c2 = use_machine(m);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |