Submission #154039

#TimeUsernameProblemLanguageResultExecution timeMemory
154039mohamedsobhi777Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" using namespace std; std::string guess_sequence(int N) { string ret = ""; string chs = "ABXY"; if( pres("XY") ) { if(pres("X"))ret = "X" , chs = "ABY"; else ret = "Y" , chs = "ABX"; } else { if(pres("A"))ret = "A" , chs = "BXY"; else ret = "B" , chs ="AXY"; } for(int i = 1;i<N;i++) { bool ok = 0; for(int j = 0;j<2;j++) { string ask = ret; ask+=chs[j]; if( press( ask ) ==i+1 ) { ret+=chs[j]; ok = 1; break; } } if(ret.size()==i) ret+=chs[2]; } return ret; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:9: error: 'pres' was not declared in this scope; did you mean 'press'?
    9 |     if( pres("XY") )
      |         ^~~~
      |         press
combo.cpp:34:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |         if(ret.size()==i)
      |            ~~~~~~~~~~^~~