제출 #1364561

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

string guess_sequence(int N){
    char first;
    if(press("AB") > 0) {
        if(press("A") > 0) {
            first = 'A';
        }
        else {
            first = 'B';
        }
    }
    else {
        if(press("X") > 0){
            first = 'X';
        }
        else{
            first = 'Y';
        }
    }

    string curpref ;
    curpref += first;
    vector<char> not_first;

    if(first != 'A'){
        not_first.push_back('A');
    }
    if(first != 'B'){
        not_first.push_back('B');
    }
    if(first != 'X'){
        not_first.push_back('X');
    }
    if(first != 'Y'){
        not_first.push_back('Y');
    }

    for(int pos = 2; pos <= N - 1; pos++){
        
        //return pos if it is 0
        string ask = curpref;
        ask += not_first[0];

        //return pos + 1 if it is 1
        ask += curpref;
        ask += not_first[1];
        ask += not_first[2];
        ask += curpref;
        ask += not_first[1];
        ask += not_first[1];
        ask += curpref;
        ask += not_first[1];
        ask += not_first[0];

        //return pos - 1 if it is 2

        pressans = press(ask);
        if(pressans == pos){
            curpref += not_first[0];
        }
        else if(pressans == pos + 1){
            curpref += not_first[1];
        }
        else {
            curpref += not_first[2];
        }
    }

    if(press(curpref + not_first[0]) == N) {
        curpref += not_first[0];
    }
    else if(press(curpref + not_first[1]) == N) {
        curpref += not_first[1];
    }
    else {
        curpref += not_first[2];
    }

    return curpref;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:60:9: error: 'pressans' was not declared in this scope; did you mean 'press'?
   60 |         pressans = press(ask);
      |         ^~~~~~~~
      |         press