Submission #955854

# Submission time Handle Problem Language Result Execution time Memory
955854 2024-03-31T15:30:03 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,c = "ABXY";
    int f = 0;
    for(int i = 0;i < 3;i++){
        f = press(string(1,c[i]));
        if(f){s += c[i];c.erase(i,1);break;}
    }
    if(!f){s += c.back();c.pop_back();}

    for(int i = 1;i < n;i++){
        f = 0;
        for(int j = 0;j < 2;j++){
            if(press(s + string(1,c[j])) > s.size()){f = 1;s += c[j];break;}
        }
        if(!f){s += c.back();}
    }

    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:11:13: error: 'press' was not declared in this scope
   11 |         f = press(string(1,c[i]));
      |             ^~~~~
combo.cpp:19:16: error: 'press' was not declared in this scope
   19 |             if(press(s + string(1,c[j])) > s.size()){f = 1;s += c[j];break;}
      |                ^~~~~