Submission #101643

#TimeUsernameProblemLanguageResultExecution timeMemory
101643coldEr66Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"
#define SZ(a) (int)a.size()
using namespace std;

int press(string p);
char pre(){
  if (press("AB") > 0) {
    if (press("A") > 0) return 'A';
    return 'B';
  }
  else {
    if (press("X") > 0) return 'X';
    return 'Y';
  }
}
string s="ABXY";
char ok[3];
string guess_sequence(int N){
  string S = "";
  S += pre();
  int cnt = 0;
  for (int i=0;i<4;i++) {
    if (s[i] == S[0]) continue;
    ok[cnt++] = s[i];
  }

  for (int i=1;i<N-1;i++) {
    string tmp = S + ok[0];
    for (int j=0;j<3;j++) tmp += (S + ok[1] + ok[j]);
    int Q = press(tmp);
    if (Q == SZ(s)) S += ok[2];
    else if (Q == SZ(s)+1) S += ok[0];
    else S += ok[1];
  }

  if (N > 1) {
    for (int i=0;i<2;i++) {
      if (press(S + ok[i]) == SZ(s) + 1) {
        S += ok[i];
        break;
      }
    }
    if (SZ(s) < N) s += ok[2];
  }

  return S;
}

int main(){

}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccbIvKPF.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc5LZD5F.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status