Submission #955586

# Submission time Handle Problem Language Result Execution time Memory
955586 2024-03-31T04:25:29 Z ASGA_RedSea Combo (IOI18_combo) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

//int press(string s){cout<<"press : "<<s<<" : ";int r;cin>>r;return r;}

string guess_sequence(int n){
    string s;
    string arr = "ABXY";

    for(auto& i : arr){
        string ss;ss += i;
        if(press(ss) == 1){
            s += i;
            break;
        }
    }

    arr.erase(find(arr.begin(),arr.end(),s[0]) - arr.begin(),1);

    while(s.size() < n){
        string p = s;
        for(auto& i : arr){
            p += i;
            int r = press(p);
            if(r == s.size() + 1)break;
            p.pop_back();
        }
        s = p;
    }

    return s;
}

//int main(){int n;cin>>n;cout<<guess_sequence(n);return 0;}

Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:12: error: 'press' was not declared in this scope
   13 |         if(press(ss) == 1){
      |            ^~~~~
combo.cpp:21:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |     while(s.size() < n){
      |           ~~~~~~~~~^~~
combo.cpp:25:21: error: 'press' was not declared in this scope
   25 |             int r = press(p);
      |                     ^~~~~
combo.cpp:26:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |             if(r == s.size() + 1)break;
      |                ~~^~~~~~~~~~~~~~~