제출 #1350230

#제출 시각아이디문제언어결과실행 시간메모리
1350230bozhoCombo (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

string guess_sequence(int n)
{
    char c[4] = {'B', 'X', 'A', 'Y'};
    int f, l;
    for (int i = 0; i < 4; i++)
    {
        if (press(c[i]))
        {
            f = i;
            break;
        }
    }
    l = f;
    string s = "", tr = "";
    s += c[f];
    for (int i = 0; i < n; i++)
        tr += 'A';
    tr[0] = c[f];
    int op;
    while (s.size() < n)
    {
        for (int j = 0; j < 4; j++)
        {
            if (j != l && j != f)
            {
                for (int i = s.size(); i < n; i++)
                    tr[i] = c[j];
                l = j;
                break;
            }
        }
        op = press(tr);
        for (int i = s.size(); i < op; i++)
            s += c[l];
    }
    return s;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:13: error: 'press' was not declared in this scope
   10 |         if (press(c[i]))
      |             ^~~~~
combo.cpp:35:14: error: 'press' was not declared in this scope
   35 |         op = press(tr);
      |              ^~~~~