Submission #106348

#TimeUsernameProblemLanguageResultExecution timeMemory
106348kig9981Combo (IOI18_combo)C++17
0 / 100
4 ms456 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { int i; string ret; string S="ABXY"; if(press("AB")) { if(press("X")) ret="Y"; else ret="X"; } else { if(press("A")) ret="A"; else ret="B"; } S.erase(ret[0]); while(ret.size()<N) { if(ret.size()+1==N) { if(press(ret+S[0])==N) ret+=S[0]; else if(press(ret+S[1])==N) ret+=S[1]; else ret+=S[2]; } else { int temp=press(ret+S[0]+S[0]+ret+S[0]+S[1]+ret+S[1]+S[0]); if(temp==ret.size()) ret.push_back(S[2]); else if(temp==ret.size()+1) { temp=press(ret+S[1]+S[1]); if(temp==ret.size()) ret.push_back(S[0]), ret.push_back(S[2]); else if(temp==ret.size()+1) ret.push_back(S[1]), ret.push_back(S[2]); else ret.push_back(S[1]), ret.push_back(S[1]); } else { temp=press(ret+S[0]+S[1]); if(temp==ret.size()) ret.push_back(S[1]), ret.push_back(S[0]); else if(temp==ret.size()+1) ret.push_back(S[0]), ret.push_back(S[0]); else ret.push_back(S[0]), ret.push_back(S[1]); } } } return ret; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |  while(ret.size()<N) {
      |        ~~~~~~~~~~^~
combo.cpp:21:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |   if(ret.size()+1==N) {
      |      ~~~~~~~~~~~~^~~
combo.cpp:28:11: 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(temp==ret.size()) ret.push_back(S[2]);
      |       ~~~~^~~~~~~~~~~~
combo.cpp:29:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |    else if(temp==ret.size()+1) {
      |            ~~~~^~~~~~~~~~~~~~
combo.cpp:31:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     if(temp==ret.size()) ret.push_back(S[0]), ret.push_back(S[2]);
      |        ~~~~^~~~~~~~~~~~
combo.cpp:32:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     else if(temp==ret.size()+1) ret.push_back(S[1]), ret.push_back(S[2]);
      |             ~~~~^~~~~~~~~~~~~~
combo.cpp:37:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     if(temp==ret.size()) ret.push_back(S[1]), ret.push_back(S[0]);
      |        ~~~~^~~~~~~~~~~~
combo.cpp:38:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     else if(temp==ret.size()+1) ret.push_back(S[0]), ret.push_back(S[0]);
      |             ~~~~^~~~~~~~~~~~~~
combo.cpp:8:6: warning: unused variable 'i' [-Wunused-variable]
    8 |  int i;
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...