Submission #1126937

#TimeUsernameProblemLanguageResultExecution timeMemory
1126937orzdraiduwu콤보 (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;
#define int long long

int press(string g) {
  cout << g << flush;
  int res; cin >> res;
  return res;
}

string guess_sequence(int sz) {
  vector<string> q = {"A", "B", "X", "Y"}, n;
  string rm = "-", re;
  for(int i = 0 ; i < 2 ; i++) {
    if(press(q[i]) == 1) {
      rm = q[i];
      break;
    }
  }

  if(rm == "-") rm = "Y";
  re.push_back(rm[0]);
  for(int i = 0 ; i < q.size() ; i++) {
    if(q[i] == rm) continue;
    n.push_back(q[i]);
  }

  for(int i = 1 ; i < sz ; i++) {
    for(int j = 0 ; j < n.size() ; j++) {
      re.push_back(q[i][0]);
      if(press(re) == i+1) break;
      re.pop_back();
    }
  }

  return re;
}

// signed main() {
  
// }

Compilation message (stderr)

/usr/bin/ld: /tmp/cc2LqDi2.o: in function `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/ccso8DwB.o:combo.cpp:(.text+0x60): first defined here
/usr/bin/ld: /tmp/cc2LqDi2.o: in function `main':
grader.cpp:(.text.startup+0x4c): undefined reference to `guess_sequence[abi:cxx11](int)'
collect2: error: ld returned 1 exit status