# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
484642 | AmirElarbi | Counting Mushrooms (IOI20_mushrooms) | C++14 | 2 ms | 304 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 vi vector<int>
#define ve vector
#define ll long long
#define vf vector<float>
#define vll vector<pair<ll,ll>>
#define ii pair<int,int>
#define vvi vector<vi>
#define vii vector<ii>
#define gii greater<ii>
#define pb push_back
#define fi first
#define se second
#define INF 1e7
#define eps 1e-18
#define eps1 1e-25
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);
#define MAX_A 1e5+5
#define V 450
using namespace std;
const int MOD = 1e9+7;
const int nax = 2000005;
int count_mushrooms(int n) {
int X = 199;
vi typ[2];
for(int i = 1; i <= min(n-1,X); i++){
typ[use_machine({0,i})].pb(i);
}
int cnt = typ[0].size()+1;
for (int i = 200; i < n; i+=200)
{
vi a;
for(int j = i; j < i+typ[0].size();j++){
a.pb(typ[0][j-i]);
a.pb(j);
}
int res = use_machine(a);
if(typ[0].size() == 0)
cnt += typ[0].size()-(res/2)-1;
else {
cnt += typ[0].size()-((res+1)/2);
}
a.clear();
for(int j = i+typ[0].size(); j < i+200;j++){
a.pb(j-i+typ[0].size());
a.pb(j);
}
res = use_machine(a);
if(typ[1].size() == 0)
cnt += (res/2)-1;
else {
cnt += ((res+1)/2);
}
}
return cnt;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |