Submission #983570

#TimeUsernameProblemLanguageResultExecution timeMemory
983570user736482Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; string guess_sequence(int N){ string result; int guessresult; guessresult = press("AB"); if(guessresult){ guessresult = press("A"); if(guessresult) result = "A"; else result = "B"; } else{ guessresult = press("X"); if(guessresult) result = "X"; else result = "Y"; } if(N==1) return result; if(result[0]=='A') for(int i=0;i<N-2;i++){ guessresult = press(result + "B" + result + "XB" + result + "XX" + result + "XY"); if(guessresult == result.size()-1){ result.push_back('B'); } else if(guessresult == result.size()){ result.push_back('Y'); } else{ result.push_back('X'); } } if(result[0]=='B') for(int i=0;i<N-2;i++){ guessresult = press(result + "A" + result + "XA" + result + "XX" + result + "XY"); if(guessresult == result.size()-1){ result.push_back('A'); } else if(guessresult == result.size()){ result.push_back('Y'); } else{ result.push_back('X'); } } else if(result[0]=='X') for(int i=0;i<N-2;i++){ guessresult = press(result + "B" + result + "AB" + result + "AA" + result + "AY"); if(guessresult == result.size()-1){ result.push_back('B'); } else if(guessresult == result.size()){ result.push_back('Y'); } else{ result.push_back('A'); } } else if(result[0]=='Y') for(int i=0;i<N-2;i++){ guessresult = press(result + "B" + result + "XB" + result + "XX" + result + "XA"); if(guessresult == result.size()-1){ result.push_back('B'); } else if(guessresult == result.size()){ result.push_back('A'); } else{ result.push_back('X'); } } guessresult = press(result+"A"+result+"B"); if(guessresult){ guessresult = press(result+"A"); if(guessresult) result.push_back('A'); else result.push_back('B'); } else{ guessresult = press(result+"X"); if(guessresult) result.push_back('X'); else result.push_back('Y'); } return result; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:19: error: 'press' was not declared in this scope
    8 |     guessresult = press("AB");
      |                   ^~~~~
combo.cpp:28:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |             if(guessresult == result.size()-1){
      |                ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
combo.cpp:31:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             else if(guessresult == result.size()){
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
combo.cpp:41:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |             if(guessresult == result.size()-1){
      |                ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
combo.cpp:44:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |             else if(guessresult == result.size()){
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
combo.cpp:54:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |             if(guessresult == result.size()-1){
      |                ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
combo.cpp:57:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |             else if(guessresult == result.size()){
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
combo.cpp:67:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |             if(guessresult == result.size()-1){
      |                ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
combo.cpp:70:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |             else if(guessresult == result.size()){
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~~~~~