# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
304023 | Fdg | Counting Mushrooms (IOI20_mushrooms) | C++14 | 0 ms | 0 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 <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
// #include "mushrooms.h"
using namespace std;
const int VAL = 141;
vector<int> a, b;
int count_mushrooms(int n) {
srand(time(NULL));
vector<int> v;
for (int i = 1; i < n; ++i)
v.push_back(i);
random_shuffle(v.begin(), v.end());
int ans = 0, pos = 0;
a.push_back(0);
while (pos < v.size()/*a.size() < VAL || b.size() < VAL*/) {
if (a.size() > 1) {
vector<int> arr = {a[0]};
if (pos < v.size()) arr.push_back(v[pos]), ++pos;
arr.push_back(a[1]);
if (pos < v.size()) arr.push_back(v[pos]), ++pos;