Submission #1370333

#TimeUsernameProblemLanguageResultExecution timeMemory
1370333Godgift42Combo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

const long long md=1000000007;
const long long b=31;
const long long d=29;
const long long c=61;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

std::string guess_sequence(int N) {
  int cur=1;
  string st="";
  vector<char> ch;
  if(press("A")){
    st="A";
    ch={'B','X','Y'};
  }
  else if(press("B")){
    st="B";
    ch={'A','X','Y'};
  }
  else if(press("X")){
    st="X";
    ch={'A','B','Y'};
  }
  else{
    st="Y";
    ch={'A','B','X'};
  }
  long long rn=1;
  while(st.size()<N){
    cout << st << "\n";
    cur=st.size();
    
    bool f=false;
    rn=rng();
    for(int i=0;i<2;i++){
      string ps=st;
      ps+=ch[(i+rn)%3];
      long long crn=(rn+i*c)%md;
      for(int i=st.size();i<N;i++){
        crn=rng();
        ps+=ch[(crn)%3];
      }
      cout << ps << "\n";
      int g=press(ps);
      if(g!=st.size()){
        f=true;
        for(int j=cur;j<g;j++)st+=ps[j];
        break;
      }
    }
    if(!f)st+=ch[(2+rn)%3];
    rn=(rn*d)%md; 
  }
  return st;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:15:6: error: 'press' was not declared in this scope
   15 |   if(press("A")){
      |      ^~~~~
combo.cpp:47:13: error: 'press' was not declared in this scope
   47 |       int g=press(ps);
      |             ^~~~~