제출 #1142512

#제출 시각아이디문제언어결과실행 시간메모리
1142512fz_00콤보 (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"

string guess_sequence(int n){
    string p = "";
    set <string> tr;
    set.insert("A");
    set.insert("B");
    set.insert("X");
    set.insert("Y");
    int c  = press("AB");
    if(c==1){
        c = press("A");
        if(c==1)p+="A";
        else p+="B";
    }
    else {
        c = press("X");
        if(c==1)p+="X";
        else p+="Y";
    }
    set.erase(p);
    string b, x, y;
    c = 0;{}
    for(string h: tr){
        if(c==0)b = h
        else if(c==1)x = h;
        else y = h;
        c++;
    }

    int count = 1;
    for(int i=0; i<n-2; i++){
        string t = p+b+p+x+y+p+x+x+p+x+b;
        c = press(t);
        if(c==count)p+=y
        else if(c==count+1)p+=b;
        else p+=x;
        count++;
    }
    string t = p+b;
    c = press(t);
    if(c==n)p+=b;
    else{
        c = press(p+x);
        if(c==n)p+=x;
        else p+=y;
    }
    return p;

}

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp:4:1: error: 'string' does not name a type; did you mean 'stdin'?
    4 | string guess_sequence(int n){
      | ^~~~~~
      | stdin