Submission #154040

#TimeUsernameProblemLanguageResultExecution timeMemory
154040mohamedsobhi777콤보 (IOI18_combo)C++14
30 / 100
102 ms424 KiB
#include "combo.h" using namespace std; std::string guess_sequence(int N) { string ret = ""; string chs = "ABXY"; if( press("XY") ) { if(press("X"))ret = "X" , chs = "ABY"; else ret = "Y" , chs = "ABX"; } else { if(press("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: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)
      |            ~~~~~~~~~~^~~
combo.cpp:22:14: warning: variable 'ok' set but not used [-Wunused-but-set-variable]
   22 |         bool ok = 0;
      |              ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...