Submission #1007121

#TimeUsernameProblemLanguageResultExecution timeMemory
1007121altern23콤보 (IOI18_combo)C++17
88 / 100
25 ms1872 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
#define pb push_back
#define ll int

string guess_sequence(int n){
  string f;
  string s = "";
  vector<string>vec;
  for(int i=1;i<=n;i++){
    if(i == 1 || i == n){
      ll x = press(s + "A" + s + "B");
      ll y = press(s + "X" + s + "Y");
      if(x > y){
        ll a = press(s + "A");
        ll b = press(s + "B");
        if(a > b){
          s += "A";
          if(i == 1) f = "A";
        }
        else{
          s += "B";
          if(i == 1) f = "B";
        }
      }
      else{
        ll a = press(s + "X");
        ll b = press(s + "Y");
        if(a > b){
          s += "X";
          if(i == 1) f = "X";
        }
        else {
          s += "Y";
          if(i == 1) f = "Y";
        }
      }
    }
    else{
      if(vec.empty()){
        if(f != "A") vec.pb("A");
        if(f != "B") vec.pb("B");
        if(f != "X") vec.pb("X");
        if(f != "Y") vec.pb("Y");
      }
      string tmp = s + vec[0];
      for(int j=0;j<vec.size();j++) tmp += s + vec[1] + vec[j];
      ll a = press(tmp);
      if(a == i-1){
        s += vec[2];
      }
      else if(a == i+1){
        s += vec[1];
      }
      else s += vec[0];
    }
  }
  return s;
}

/*

*/

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:48:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |       for(int j=0;j<vec.size();j++) tmp += s + vec[1] + vec[j];
      |                   ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...