# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1060453 | 2024-08-15T14:52:09 Z | Mihailo | Counting Mushrooms (IOI20_mushrooms) | C++17 | 0 ms | 0 KB |
#include <cstdio> #include <cstdlib> #include <cstdarg> #include <bits/stdc++.h> #define mp make_pair #define pb push_back #define xx first #define yy second #define pll pair<long long, long long> #define MOD 1000000007 typedef long long ll; using namespace std; mt19937 mt(time(nullptr)); int solve(int l, int r) { if(l==r) return 1; int m=(l+r)/2; int left=solve(l, m); int right=solve(m+1, r); vector<int> v; v.pb(l); v.pb(m+1); if(use_machine(v)) { return left+(r-m)-right; } else { return left+right; } } int count_mushrooms(int N) { return solve(0, N-1); }