Submission #1325915

#TimeUsernameProblemLanguageResultExecution timeMemory
1325915x_aCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

string guess_sequence(int N) {
  string p = "", s = "";
  int last = 0, x;
  char t = 'x';
  vector<char> A = {'A', 'B', 'X', 'Y'}, c;
  for (int i = 0; i < 1; ++i) {
    
    x = press("AB");
    if(x == 1){
      if(press("A")) s = "A";
      else s = "B";
    }
    else{
      if(press("C")) s = "C";
      else s = "D";
    }
    for(char x : A) if(x != s[0]) c.push_back(x);
    int last = 1;

    for(int i = 1; i < N - 1; i ++){
      x = press(s + c[0] + s + c[1] + c[0] + s + c[1] + c[1] + s + c[1] + c[2]);
      if(x == last + 1){
        s += c[0];
      }
      else if(last + 2){
        s += c[1];
      }
      else{
        s += c[2];
      }
      last ++;
    }
    int = cnt = 0;
    for(char x : c){
      if(cnt == 2){
        s += x;
        break;
      }
      if(press(s + x) == last + 1) s += x;
      cnt ++;
    }
  }
  return s;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:9: error: expected unqualified-id before '=' token
   38 |     int = cnt = 0;
      |         ^
combo.cpp:40:10: error: 'cnt' was not declared in this scope; did you mean 'int'?
   40 |       if(cnt == 2){
      |          ^~~
      |          int
combo.cpp:45:7: error: 'cnt' was not declared in this scope; did you mean 'int'?
   45 |       cnt ++;
      |       ^~~
      |       int