Submission #1362013

#TimeUsernameProblemLanguageResultExecution timeMemory
1362013lyra_g13Combo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>
using ll = long long;
using namespace std;

int press(string p);

string guess_sequence(int N) {
  char t;
  if (press("A"))
    t = 'A';
  else if (press("B"))
    t = 'B';
  else if (press("X"))
    t = 'X';
  else
    t = 'Y';

  /*
  B YB YX YY
  */

  string s;
  s += t;

  for (int i = 1; i < n; i++) {

    string buff = s;
    if (i != n - 1) {
      buff = buff + "B" + buff + "YB" + buff + "YX" + buff + "YY";
      ll find = press(buff);
      if (find == s.size() + 1) {
        s += "B";
      } else if (find == s.size() + 2)
        s += "Y";
      else {
        s += "X";
      }
    } else if (i == n - 1) {
      sting ans = buff + "B";
      ll find = press(ans);
      if (find == n) {
        return ans;
      } else {
        ans = buff + "Y";
        find = press(ans);
        if (find == n) {
          return ans;
        } else {
          ans = buff + "X";
          return ans;
        }
      }
    }
  }
  return ans;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:23: error: 'n' was not declared in this scope
   26 |   for (int i = 1; i < n; i++) {
      |                       ^
combo.cpp:40:7: error: 'sting' was not declared in this scope
   40 |       sting ans = buff + "B";
      |       ^~~~~
combo.cpp:41:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
   41 |       ll find = press(ans);
      |                       ^~~
      |                       abs
combo.cpp:56:10: error: 'ans' was not declared in this scope; did you mean 'abs'?
   56 |   return ans;
      |          ^~~
      |          abs