Submission #435217

#TimeUsernameProblemLanguageResultExecution timeMemory
435217SupersonicCombo (IOI18_combo)C++14
0 / 100
4 ms268 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char c; string m(string k){ string r; for(auto i:k){ if(i=='A')r+=c; else if(i==c)r+='A'; else r+=i; } return r; } std::string guess_sequence(int n) { int q=press("XA"); if(q==1){ q=press("X"); if(q==1)c='X'; else c='A'; } else{ q=press("B"); if(q==1)c='B'; else c='Y'; } string r="A";if(n==1)return m(r); while(r.length()<n-1){ q=press(m(r+"X"+r+"YX"+r+"YB"+r+"YY")); if(q==r.length())r+="B"; else if(q==r.length()+1)r+="X"; else r+="Y"; } if(press(m(r+"X"))==n)r+="X"; else if(press(m(r+"Y"))==n)r+="Y"; else r+="B"; return m(r); }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:27:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |   while(r.length()<n-1){
      |         ~~~~~~~~~~^~~~
combo.cpp:29:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     if(q==r.length())r+="B";
      |        ~^~~~~~~~~~~~
combo.cpp:30:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     else if(q==r.length()+1)r+="X";
      |             ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...