# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
346062 | teehandsome | Counting Mushrooms (IOI20_mushrooms) | C++14 | 1 ms | 384 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;
int count_mushrooms(int n) {
if(n&1) {
vector<int> a,b;
for(int i=1;i<=n/2;i++) {
a.push_back(0); a.push_back(i);
}
a.push_back(0);
int res1=use_machine(a);
for(int i=n/2+1;i<n;i++) {
b.push_back(0); b.push_back(i);
}
b.push_back(0);
int res2=use_machine(b);
int ans1=a.size()-1-res1;
int ans2=b.size()-1-res2;
return (ans1+ans2)/2;
}
else {
vector<int> temp,a,b;
temp.push_back(0); temp.push_back(1);
int ans3=1-use_machine(temp);
for(int i=2;i<=n/2;i++) {
a.push_back(0); a.push_back(i);
}
a.push_back(0);
int res1=use_machine(a);
for(int i=n/2+1;i<n;i++) {
b.push_back(0); b.push_back(i);
}
b.push_back(0);
int res2=use_machine(b);
int ans1=a.size()-1-res1;
int ans2=b.size()-1-res2;
return ans3+(ans1+ans2)/2;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |