# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
661460 | evenvalue | Counting Mushrooms (IOI20_mushrooms) | C++17 | 0 ms | 208 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;
template<typename T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using max_heap = priority_queue<T, vector<T>, less<T>>;
using int64 = long long;
using ld = long double;
constexpr int kInf = 1e9 + 10;
constexpr int64 kInf64 = 1e15 + 10;
constexpr int kMod = 1e9 + 7;
int count_mushrooms(int n) {
if (n == 2) {
return 2 - use_machine({0, 1});
}
vector<int> segments;
for (int i = 2; i < n; i += 2) {
const vector<int> foo = {i - 1, 0, i};
segments.insert(segments.end(), foo.begin(), foo.end());
}
int ans = 1 + (n % 2 == 0 ? 1 - use_machine({0, n - 1}) : 0);
ans += ((n % 2 == 0) ? n - 2 : n - 1) - use_machine(segments);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |