Submission #380106

#TimeUsernameProblemLanguageResultExecution timeMemory
380106Dan4LifeCombo (IOI18_combo)C++17
0 / 100
2 ms256 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;

string guess_sequence(int N) {
  string p = "", x = "ABXY";
  for(int i = 0; i < 3; i++)
  {
      p = x[i];
      int first = press(p);
      if(first==1){
        x.erase(x.begin()+i);
        break;
      }
  }
  if(x.size()==4)p+="Y", x.erase(prev(x.end()));
  string S = p;
  for(int i = 1; i < N; i++)
  {
      bool got_next = false;
      for(int j = 0; j < 2; j++){
        int next = press(p+x[j]);
        if(next==p.size()+1){
            p+=x[j]; got_next =true; break;
        }
      }
      if(!got_next)p+=x[2];
  }
  S=p;
  return S;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:16: 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(next==p.size()+1){
      |            ~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...