Submission #306082

#TimeUsernameProblemLanguageResultExecution timeMemory
306082stoyan_malininCombo (IOI18_combo)C++14
5 / 100
1 ms200 KiB
#include "combo.h" //#include "grader.cpp" using namespace std; string guess_sequence(int N) { string ans = ""; if(press("AB")>0) { if(press("A")>0) ans += "A"; else ans += "B"; } else { if(press("X")>0) ans += "X"; else ans += "Y"; } string A = "A", B = "B", X = "X", Y = "Y"; if(ans[0]==B[0]) swap(A, B); if(ans[0]==X[0]) swap(A, X); if(ans[0]==Y[0]) swap(A, Y); for(int i = 1;i<N-1;i++) { string ask = ans+B+B+ans+B+X+ans+B+Y+ans+X; int res = press(ask) - ans.size(); if(res==0) ans += Y; else if(res==1) ans += X; else if(res==2) ans += B; } if(press(ans+"A"+ans+"B")>ans.size()) { if(press(ans+"A")>ans.size()) ans += "A"; else ans += "B"; } else { if(press(ans+"X")>ans.size()) ans += "X"; else ans += "Y"; } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:36:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     if(press(ans+"A"+ans+"B")>ans.size())
      |        ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
combo.cpp:38:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         if(press(ans+"A")>ans.size()) ans += "A";
      |            ~~~~~~~~~~~~~~^~~~~~~~~~~
combo.cpp:43:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         if(press(ans+"X")>ans.size()) ans += "X";
      |            ~~~~~~~~~~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...