Submission #998487

#TimeUsernameProblemLanguageResultExecution timeMemory
998487ezzzayCombo (IOI18_combo)C++14
5 / 100
1 ms344 KiB
#include "combo.h"
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
std::string guess_sequence(int N) {
  string s;
  vector<string>h={"A","B","X","Y"};
  if(press(h[0]+h[1])){
    if(press(h[1]))swap(h[0],h[1]);
  }
  else if(press(h[2])){
    swap(h[0],h[2]);
  }
  else{
    swap(h[0],h[3]);
  }
  s+=h[0];
  for(int i=2;i<N;i++){
    string tmp=s+h[1]+s+h[2]+h[1]+s+h[2]+h[2]+s+h[2]+h[3];
    int t=press(tmp);
    if(t==s.size()+1){
      s+=h[1];
    }
    else if(t==s.size()+2){
      s+=h[2];
    }
    else{
      s+=h[3];
    }
  }
  if(press(s+h[1])==s.size()+1){
    s+=h[1];
  }
  else if(press(s+h[2])==s.size()+1){
    s+=h[2];
  }
  else{
    s+=h[3];
  }
  return s;

}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:9: 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(t==s.size()+1){
      |        ~^~~~~~~~~~~~
combo.cpp:26:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     else if(t==s.size()+2){
      |             ~^~~~~~~~~~~~
combo.cpp:33:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   if(press(s+h[1])==s.size()+1){
      |      ~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:36:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |   else if(press(s+h[2])==s.size()+1){
      |           ~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...