Submission #588335

#TimeUsernameProblemLanguageResultExecution timeMemory
588335supercatexCounting Mushrooms (IOI20_mushrooms)C++14
0 / 100
0 ms208 KiB
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;

void check_1(int x1, vector<int> &a, vector<int> &b)
{
    int x = use_machine(vector<int>{0, x1});
    if (x == 0) {
        a.push_back(x1);
    } else {
        b.push_back(x1);
    }
}

void check_2(int x1, int x2, vector<int> &a, vector<int> &b)
{
    int x = use_machine(vector<int>{x1, 0, x2});
    if (x == 0) {
        a.push_back(x1);
        a.push_back(x2);
    } else if (x == 2) {
        b.push_back(x1);
        b.push_back(x2);
    } else {
        x = use_machine(vector<int>{0, x1});
        if (x == 0) {
            a.push_back(x1);
            b.push_back(x2);
        } else {
            a.push_back(x2);
            b.push_back(x1);
        }
    }
}

void check_3(int x1, int x2, int x3, vector<int> &a, vector<int> &b)
{

}

int count_mushrooms(int n)
{
    vector<int> a, b;
    a.push_back(0);

    for (int i = 1; i < n; i++) {
        if (i + 1 < n)
            check_2(i, i + 1, a, b);
        else
            check_1(i, a, b);
    }
    return a.size();
}
#Verdict Execution timeMemoryGrader output
Fetching results...