Submission #770719

#TimeUsernameProblemLanguageResultExecution timeMemory
770719AtinaRCombo (IOI18_combo)C++14
5 / 100
1 ms288 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((int)res.size()<N-1) { string cnt=res+possible[0]+ res+possible[1]+possible[0] + res+possible[1]+possible[1] + res+possible[1]+possible[2]; int tmp=press(cnt); if(tmp==res.size()+1) { res+=possible[0]; } else if(tmp>=res.size()+2) { res+=possible[1]; } else if(tmp==res.size()) { res+=possible[2]; } } int tmp; if(press(res+possible[0])==N) { res+=possible[0]; } else if(press(res+possible[1])==N) { res+=possible[1]; } else { res+=possible[2]; } return res; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:61:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |         if(tmp==res.size()+1)
      |            ~~~^~~~~~~~~~~~~~
combo.cpp:65:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |         else if(tmp>=res.size()+2)
      |                 ~~~^~~~~~~~~~~~~~
combo.cpp:69:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |         else if(tmp==res.size())
      |                 ~~~^~~~~~~~~~~~
combo.cpp:74:9: warning: unused variable 'tmp' [-Wunused-variable]
   74 |     int tmp;
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...