Submission #477035

#TimeUsernameProblemLanguageResultExecution timeMemory
477035glomeCombo (IOI18_combo)C++17
0 / 100
3 ms456 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

std::string guess_sequence(int N) {
  set<int> s;
  s.insert('A');
  s.insert('B');
  s.insert('X');
  string S;
  char cur;
  for (int i = 0; i<N; i++) {
    if(i == 0) {
      bool ok = 0;
      for (char c : s) {
        if(press(string(1, c))) {
          S.push_back(c);
          s.erase(c);
          ok = 1;
          break;
        }
      }
      if(!ok) {
        S.push_back('Y');
        S.erase('A');
        cur = 'A';
      }
      else {
        cur = 'Y';
      }
      continue;
    }
    bool ok = 0;
    for (char c : s) {
      if(press(S + c) == S.size() + 1) {
        ok = 1;
        S.push_back(c);
        break;
      }
    }
    if(!ok) {
      S.push_back(cur);
    }
  }
  return S;
}

Compilation message (stderr)

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