Submission #1129898

#TimeUsernameProblemLanguageResultExecution timeMemory
1129898pedreitorzeldaCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
std::string guess_sequence(int N){
    std::string ans;
    std::vector<char>possible = {'A','B','X','Y'};
    for(int i=0;i<N;i++){
        if(i==0){
            for(int j=0;j<3;j++){
                std::string q(N,possible[j]);
                int tmp = press(q);
                if(tmp==1){
                    ans+=possible[j];
                    break;
                }
            }if(ans.size()==i)ans+=possible[3];
        }else{
            for(int j=0;j<3;j++){
                std::string q(N-i-1,ans[0]);
                std::string qu = ans+possible[j]+q;
                int tmp = press(qu);
                if(tmp==1){
                    ans+=possible[j];
                    break;
                }
            }if(ans.size()==i)ans+=possible[3];
        }
    }
    return ans;
}

Compilation message (stderr)

combo.cpp:1:6: error: 'string' in namespace 'std' does not name a type
    1 | std::string guess_sequence(int N){
      |      ^~~~~~
combo.cpp:1:1: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
  +++ |+#include <string>
    1 | std::string guess_sequence(int N){