Submission #1324397

#TimeUsernameProblemLanguageResultExecution timeMemory
1324397riafhasan2010Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h"
using namespace std;

std::string guess_sequence(int N) {
  string s, p = "";
  if (press("A")) p += 'A', alpha = "BXY";
  if (press("B")) p += 'B', alpha = "AXY";
  if (press("X")) p += 'X', alpha = "ABY";
  else p += 'Y', alpha = "ABX";
  for (int i = 0; i < N; i++) {
    p += p[0];
    for (int j = 0; j < 2; j++) {
      p[i] = alpha[j];
      if (press(p) == i + 1) {
        break;
      }
      p[i] = alpha[2];
    }
  }
  return p;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:29: error: 'alpha' was not declared in this scope; did you mean 'isalpha'?
    6 |   if (press("A")) p += 'A', alpha = "BXY";
      |                             ^~~~~
      |                             isalpha
combo.cpp:7:29: error: 'alpha' was not declared in this scope; did you mean 'isalpha'?
    7 |   if (press("B")) p += 'B', alpha = "AXY";
      |                             ^~~~~
      |                             isalpha
combo.cpp:8:29: error: 'alpha' was not declared in this scope; did you mean 'isalpha'?
    8 |   if (press("X")) p += 'X', alpha = "ABY";
      |                             ^~~~~
      |                             isalpha
combo.cpp:9:18: error: 'alpha' was not declared in this scope; did you mean 'isalpha'?
    9 |   else p += 'Y', alpha = "ABX";
      |                  ^~~~~
      |                  isalpha
combo.cpp:13:14: error: 'alpha' was not declared in this scope; did you mean 'isalpha'?
   13 |       p[i] = alpha[j];
      |              ^~~~~
      |              isalpha