Submission #624767

#TimeUsernameProblemLanguageResultExecution timeMemory
624767chubyxdxdCombo (IOI18_combo)C++11
30 / 100
43 ms456 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

std::string guess_sequence(int N) {
  string S= "";
  if(press("AB")){
    if(press("A"))S+='A';
    else S+='B';
  }
  else{
    if(press("X"))S+='X';
    else S+='Y';
  }
  string aux="ABXY";
  string pos;
  for(int i=0;i<aux.size();i++){
    if(S[0]!=aux[i])pos+=aux[i];
  }
  //cout<<pos<<endl;
  for(int i=1;i<N;i++){
    //cout<<S<<endl;
    if(press(S+pos[0])>S.size())S+=pos[0];
    else{
      if(press(S+pos[1])>S.size())S+=pos[1];
      else S+=pos[2];
    }
  }
  return S;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   for(int i=0;i<aux.size();i++){
      |               ~^~~~~~~~~~~
combo.cpp:23:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     if(press(S+pos[0])>S.size())S+=pos[0];
      |        ~~~~~~~~~~~~~~~^~~~~~~~~
combo.cpp:25:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |       if(press(S+pos[1])>S.size())S+=pos[1];
      |          ~~~~~~~~~~~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...