Submission #648850

#TimeUsernameProblemLanguageResultExecution timeMemory
648850LitusianoCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
string guess_sequence(int N){
  string ans;
  for(int i = 1; i<=N; ++i){
    string ans1 = ans; string ans2 = ans;
    ans1+='A'; ans2+='B';
    //if(i == 1) cout<<ans1+ans2<<" "<<press(ans1+ans2)<<endl;
    int x = press(ans1+ans2);
    if(x > i){
      i++;
      ans+="AB";
    }
    else if(x == i){
      if(press(ans1) == i) ans+='A';
      else ans+='B';
    }
    else{
      ans1[i-1] ='X';
      if(press(ans1) == i) ans+='X';
      else ans+='Y';
    }
  }
  return ans;
}

Compilation message (stderr)

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