Submission #770713

#TimeUsernameProblemLanguageResultExecution timeMemory
770713AtinaRCombo (IOI18_combo)C++14
30 / 100
43 ms528 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { char first; int f=press("AB"); if(f>=1) { f=press("A"); if(f>=1) { first='A'; } else { first='B'; } } else { f=press("X"); if(f>=1) { first='X'; } else first='Y'; } string res=""; res+=first; char possible[3]; if(first=='X') { possible[0]='A'; possible[1]='B'; possible[2]='Y'; } else if(first=='Y') { possible[0]='A'; possible[1]='B'; possible[2]='X'; } else if(first=='A') { possible[0]='X'; possible[1]='B'; possible[2]='Y'; } else if(first=='B') { possible[0]='A'; possible[1]='X'; possible[2]='Y'; } while(res.size()<N) { int tmp; string A=res+possible[0]; string B=res+possible[1]; string C=res+possible[2]; tmp=press(A); if(tmp==A.size()) { res=A; continue; } tmp=press(B); if(tmp==B.size()) { res=B; continue; } res=C; } return res; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:56:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   56 |     while(res.size()<N)
      |           ~~~~~~~~~~^~
combo.cpp:63:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |         if(tmp==A.size())
      |            ~~~^~~~~~~~~~
combo.cpp:69:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |         if(tmp==B.size())
      |            ~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...