Submission #1007220

#TimeUsernameProblemLanguageResultExecution timeMemory
1007220devariaotaCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;

string s,ans,coba;
int n;

string guess_sequence(int N) {
  n = N;
  for (int i=1; i<=n; i++) {
    if (i == 1) {
      coba = "AB";
      int x = press(coba);
      if (x == 0) {
        coba = "X";
        int y = press(coba);
        if (y == 1) {
          ans+="X";
        } else {
          ans+="Y";
        }
      } else {
        coba = "A";
        int y = press(coba);
        if (y == 1) {
          ans+="A";
        } else {
          ans+="B";
        }
      }
    } else {
      coba = ans + "B" + ans + "XB" + ans + "XX" + ans + "XY";
      int x = press(coba);
      if (x == n) {
        break;
      }
      if (x == i) {
        ans += "B";
      } else if (x == i + 1) {
        ans += "X";
      } else {
        ans += "Y";
        if (i == n) {
          int y = press(ans);
        }
      }
    }
  }
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:15: error: 'press' was not declared in this scope
   12 |       int x = press(coba);
      |               ^~~~~
combo.cpp:32:15: error: 'press' was not declared in this scope
   32 |       int x = press(coba);
      |               ^~~~~
combo.cpp:43:15: warning: unused variable 'y' [-Wunused-variable]
   43 |           int y = press(ans);
      |               ^
combo.cpp:48:1: warning: no return statement in function returning non-void [-Wreturn-type]
   48 | }
      | ^