Submission #851212

# Submission time Handle Problem Language Result Execution time Memory
851212 2023-09-18T21:03:43 Z Pajaraja Combo (IOI18_combo) C++17
Compilation error
0 ms 0 KB
//#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
char c[4]={'A','B','X','Y'};
string guess_sequence(int N)
{
    int koji=0;
    string s1="XY",s2="BY";
    if(press(s1)) koji+=2;
    if(press(s2)) koji+=1;
    string s=""+c[koji];
    vector<char> ch;
    for(int i=0;i<4;i++) if(i!=koji) ch.push_back(c[i]);
    if(N==1) return s;
    for(int i=2;i<N;i++)
    {
        string t=s+ch[0]+s+ch[1]+ch[0]+s+ch[1]+ch[1]+s+ch[1]+ch[2];
        int x=press(t);
        if(x==i) s+=ch[2];
        if(x==i+1) s+=ch[0];
        if(x==i+2) s+=ch[1];
    }
    string t1=s+ch[0],t2=s+ch[1],t3=s+ch[2];
    if(press(t1)==N) return t1;
    if(press(t2)==N) return t2;
    return t3;
}

Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:8: error: 'press' was not declared in this scope
    9 |     if(press(s1)) koji+=2;
      |        ^~~~~
combo.cpp:10:8: error: 'press' was not declared in this scope
   10 |     if(press(s2)) koji+=1;
      |        ^~~~~
combo.cpp:18:15: error: 'press' was not declared in this scope
   18 |         int x=press(t);
      |               ^~~~~
combo.cpp:24:8: error: 'press' was not declared in this scope
   24 |     if(press(t1)==N) return t1;
      |        ^~~~~
combo.cpp:25:8: error: 'press' was not declared in this scope
   25 |     if(press(t2)==N) return t2;
      |        ^~~~~