Submission #913816

#TimeUsernameProblemLanguageResultExecution timeMemory
913816stefanneaguCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

//int press(string p) {
  //int x;
  //cin >> x;
  //return x;
//}

string guess_sequence(int n) {
  // primul char
  set<string> s;
  s.insert("A");
  s.insert("B");
  s.insert("X");
  s.insert("Y");
  string primul = "";
  for(auto it : s) {
    if(press(it) == 1) {
      primul = it;
      break;
    }
  }
  s.erase(primul);
  // primul e primul char
  string ans = primul;
  string add = "";
  vector<string> v;
  for(auto it : s) {
    v.push_back(it);
  }
  for(int i = 2; i < n; i ++) {
    string apel = ans;
    apel += v[0];
    apel += ans;
    apel += v[1];
    apel += v[2];
    apel += ans;
    apel += v[1];
    apel += v[1];
    apel += ans;
    apel += v[1];
    apel += v[0];
    int x = press(apel);
    if(x == i - 1) {
      ans += v[2];
    }
    if(x == i) {
      ans += v[0];
    }
    if(x == i + 1) {
      ans += v[1];
    }
  }
  for(auto it : v) {
    string apel = ans;
    apel += it;
    if(press(apel) == n) {
      return apel;
    }
  }
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:8: error: 'press' was not declared in this scope
   20 |     if(press(it) == 1) {
      |        ^~~~~
combo.cpp:45:13: error: 'press' was not declared in this scope
   45 |     int x = press(apel);
      |             ^~~~~
combo.cpp:59:8: error: 'press' was not declared in this scope
   59 |     if(press(apel) == n) {
      |        ^~~~~
combo.cpp:13:15: warning: control reaches end of non-void function [-Wreturn-type]
   13 |   set<string> s;
      |               ^