Submission #955586

#TimeUsernameProblemLanguageResultExecution timeMemory
955586ASGA_RedSeaCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#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 (stderr)

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;
      |                ~~^~~~~~~~~~~~~~~