Submission #156411

#TimeUsernameProblemLanguageResultExecution timeMemory
156411InfiniteJest콤보 (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <algorithm>
#include <math.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;

ifstream in("input.txt");
ofstream out("output.txt");

typedef long long ll;

int n;
string g;
string s;
vector<string> p;

int press(string p)

string guess_sequence(int N){
  n=N;
  if(press("AB")>=1){
    if(press("A")>=1)s+="A";
    else s+="B";
  }
  else{
    if(press("X")>=1)s+="X";
    else s+="Y";
  }
  if(s[0]!='A')p.pb("A");
  if(s[0]!='B')p.pb("B");
  if(s[0]!='X')p.pb("X");
  if(s[0]!='Y')p.pb("Y");
  for(int i=1;i<=n-2;i++){
    int k=press(s+p[0]+s+p[1]+p[0]+s+p[1]+p[2]+s+p[1]+p[1]);
    if(k==i+1){
      s+=p[0];
    }
    else if(k>i+1){
      s+=p[1];
    }
    else{
      s+=p[2];
    }
  }
  if(n==1)return s;
  if(press(s+p[0]+s+p[1])==n){
    if(press(s+p[0])==n)s+=p[0];
    else s+=p[1];
  }
  else{
    s+=p[2];
  }
  return s;
}

int main(){
  cin>>g;
  cout<<guess_sequence((int)g.length());

}

Compilation message (stderr)

combo.cpp:25:1: error: expected initializer before 'string'
   25 | string guess_sequence(int N){
      | ^~~~~~
combo.cpp: In function 'int main()':
combo.cpp:64:9: error: 'guess_sequence' was not declared in this scope
   64 |   cout<<guess_sequence((int)g.length());
      |         ^~~~~~~~~~~~~~