| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 303895 | temurbek_khujaev | Counting Mushrooms (IOI20_mushrooms) | C++17 | 12 ms | 384 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;
int count_mushrooms(int n) {
        vector<int> a = {0};
        vector<int> b;
        int pos = 1;
        int cnta = a.size();
        while (pos < n) {
            vector<int> q;
            if (a.size() > b.size()) {
                int f = min(n - pos, (int) a.size());
                for (int i = 0; i < f; i++) {
                    q.push_back(a[i]);
                    q.push_back(pos++);
                }
                int res = use_machine(q);
                if (res & 1) {
                    b.push_back(q.back());
                } else a.push_back(q.back());
                cnta += f - (res + 1) / 2;
            } else {
                int f = min(n - pos, (int) b.size());
                for (int i = 0; i < f; i++) {
                    q.push_back(b[i]);
                    q.push_back(pos++);
                }
                int res = use_machine(q);
                if (res & 1) {
                    a.push_back(q.back());
                } else b.push_back(q.back());
                cnta += (res + 1) / 2;
            }
        }
        return cnta;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
