Submission #1142379

#TimeUsernameProblemLanguageResultExecution timeMemory
1142379FZ_Laabidi콤보 (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
string get_sequence(int n){
    string p = "";
    string trash = "AB";
    int c = press(trash);
    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";
    }
    string abc = "ABXY"; 
    string b, x, y;
    for(int i=0; i<4; i++){
        if(abc[i]!==p[0])continue ;
        if(i<=1)b = s[i];
        else if(i==2)x = s[i];
        else y = s[i];
    }
    int count = 1;
    for(int i=0; i<n-1; 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+=y;
    }
    if(N>1){
        string t = p+x+p+b;
        c = press(t);
        if(c==n){
            c = press(p+x);
            if(c==n)p+=x;
            else p+=b;
        }
        else p+=y;
    }
    return p

}

Compilation message (stderr)

combo.cpp: In function 'std::string get_sequence(int)':
combo.cpp:21:20: error: expected primary-expression before '=' token
   21 |         if(abc[i]!==p[0])continue ;
      |                    ^
combo.cpp:22:21: error: 's' was not declared in this scope
   22 |         if(i<=1)b = s[i];
      |                     ^
combo.cpp:23:26: error: 's' was not declared in this scope
   23 |         else if(i==2)x = s[i];
      |                          ^
combo.cpp:24:18: error: 's' was not declared in this scope
   24 |         else y = s[i];
      |                  ^
combo.cpp:34:8: error: 'N' was not declared in this scope
   34 |     if(N>1){
      |        ^
combo.cpp:44:13: error: expected ';' before '}' token
   44 |     return p
      |             ^
      |             ;
   45 | 
   46 | }
      | ~