제출 #588334

#제출 시각아이디문제언어결과실행 시간메모리
588334supercatexCounting Mushrooms (IOI20_mushrooms)C++14
컴파일 에러
0 ms0 KiB
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;

void check_1(int x1, vector<int> &a, vector<int> &b)
{
    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();
}

컴파일 시 표준 에러 (stderr) 메시지

mushrooms.cpp: In function 'void check_1(int, std::vector<int>&, std::vector<int>&)':
mushrooms.cpp:7:5: error: 'x' was not declared in this scope; did you mean 'x1'?
    7 |     x = use_machine(vector<int>{0, x1});
      |     ^
      |     x1