Submission #1181092

#TimeUsernameProblemLanguageResultExecution timeMemory
1181092NonbangkokCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
string guess_sequence(int N) {
  vector<char> ch = {'A','B','X','Y'};
  string p = "";
  int coins = 0;
  coins = press("AB");
  if(coins){
      coins = press("A");
      if(coins)ch.erase(ch.begin()),p += "A";
      else ch.erase(ch.begin()+1),p += "B";
  }else{
      coins = press("X");
      if(coins)ch.erase(ch.begin()+2),p += "X";
      else ch.erase(ch.begin()+3),p += "Y";
  }
  forr(i,0,3)cout << ch[i] << sp;cout << endll;
  forr(i,1,N-1){
    string a = p + ch[0] + ch[0];
    string b = p + ch[0] + ch[1];
    string c = p + ch[0] + ch[2];
    string d = p + ch[1];
    // cout << "p: " << p << endll;
    // cout << "a: " << a << endll;
    // cout << "b: " << b << endll;
    // cout << "c: " << c << endll;
    // cout << "d: " << d << endll;
    coins = press(a+b+c+d);
    if(coins-i == 2)p += ch[0];
    else if(coins-i == 1)p += ch[1];
    else p += ch[2];
    // cout << "p: " << p << endll << endll;
  }
  // cout << p << sp << p.size() << endll;
  // cout << press(p+ch[2]) << endll;
  coins = press(p+ch[0]);
  if(coins-(N-1))return p + ch[0];
  coins = press(p+ch[1]);
  if(coins-(N-1))return p + ch[1];
  return p + ch[2];
}

Compilation message (stderr)

combo.cpp:1:1: error: 'string' does not name a type
    1 | string guess_sequence(int N) {
      | ^~~~~~