Submission #1195770

#TimeUsernameProblemLanguageResultExecution timeMemory
1195770qs1Combo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include "combo.h"
using namespace std;
#define lli long long int

std::string guess_sequence(int N) {
  vector<string>c;
  lli n=press("AB");
  if(n==0){
    n=press("X");
    if(n==0){
      c={"Y","A","B","X"};
    }
    else{
      c={"X","A","B","Y"};
    }
  }
  else{
    n=press("A");
    if(n==0){
      c={"B","A","Y","X"};
    }
    else{
      c={"A","X","B","Y"};
    }
  }
  string s=c[0];
  for(lli i=1;i<N-1;i++){
    string t=s+c[1]+s+c[2]+c[1]+s+c[2]+c[2]+s+c[2]+c[3];
    n=press(t);
    if(n==i){
      s+=c[3];
    }
    else if(n==i+1){
      s+=c[1];
    }
    else{
      s+=c[2];
    }
  }
  if(press(s+c[1])==N){
    s+=c[1];
  }
  else if(press(s+c[2])==N){
    s+=c[2];
  }
  else{
    s+=c[3];
  }
  return s;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:3: error: 'vector' was not declared in this scope
    6 |   vector<string>c;
      |   ^~~~~~
combo.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include "combo.h"
  +++ |+#include <vector>
    2 | using namespace std;
combo.cpp:6:16: error: expected primary-expression before '>' token
    6 |   vector<string>c;
      |                ^
combo.cpp:6:17: error: 'c' was not declared in this scope
    6 |   vector<string>c;
      |                 ^