# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
335395 | rocks03 | Counting Mushrooms (IOI20_mushrooms) | C++14 | 3 ms | 364 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<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int use_machine(vector<int> x);
int count_mushrooms(int n){
vector<int> a, b;
a.pb(0);
int ans = 1;
for(int i = 1; i < n; i++){
if(SZ(a) == 100){
i++;
for(; i < n; i++){
vector<int> v;
int j = i;
while(j < n && j < i + 100){
v.pb(a[j - i]);
v.pb(j);
j++;
}
int res = use_machine(v);
ans += SZ(v) - (res + 1) / 2;
i = j - 1;
}
break;
}
if(SZ(b) == 100){
for(; i < n; i++){
vector<int> v;
int j = i;
while(j < n && j < i + 100){
v.pb(b[j - i]);
v.pb(j);
j++;
}
int res = use_machine(v);
ans += (res + 1) / 2;
i = j - 1;
}
break;
}
int res = use_machine({0, i});
if(res == 1){
b.pb(i);
} else{
a.pb(i);
++ans;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |