Submission #908547

#TimeUsernameProblemLanguageResultExecution timeMemory
908547dragusanu_raresCombo (IOI18_combo)C++14
100 / 100
14 ms2124 KiB
#include <iostream> #include "combo.h" using namespace std; #define P press string guess_sequence(int n){ if(n==1){ if(P("X"))return "X"; if(P("Y"))return "Y"; if(P("A"))return "A"; return "B"; } char F,a,b,c; string S; if(P("XY")){ a='A'; b='B'; if(P("X"))F='X'; else F='Y'; c='X'+'Y'-F; } else{ b='X'; c='Y'; if(P("A"))F='A'; else F='B'; a='A'+'B'-F; } S=F; while(S.size()<n-1){ string G=S+b+S+c+a+S+c+b+S+c+c; int x=P(G)-S.size(); if(!x)S+=a; else if(x&1)S+=b; else S+=c; } if(P(S+a)==n)return S+a; if(P(S+b)==n)return S+b; return S+c; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |     while(S.size()<n-1){
      |           ~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...