Submission #956248

# Submission time Handle Problem Language Result Execution time Memory
956248 2024-04-01T11:57:01 Z Faissel Combo (IOI18_combo) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#include "combo.h"
#include "grader.cpp"
#define ll long long
#define endl '\n'
string guess_sequence(int n){
    string y = "ABXY";
    string ans = "";
    if(press("AB")){
      if(press("A")){
        ans += 'A';
        y.erase(y.begin());
      }else{
        ans += 'B';
        y.erase(y.begin() + 1);
      }
    }else{
      if(press("X")){
        ans += 'X';
        y.erase(y.begin() + 2);
      }else{
        ans += 'Y';
        y.erase(y.begin() + 3);
      }
    }
    for(int i=2;i<n;i++){
      string u = ans + y[0];
      string j = ans + y[1] + y[0] + ans + y[1] + y[1] + ans + y[1] + y[2];
      string need = u+j;
      int val = press(need);
      if(val == i){
        ans += y[0];
      }else if(val == i+1){
        ans += y[1];
      }else{
        ans += y[2];
      }
      cout << ans << endl;
    }
    if(n > 1){
    if(press(ans + y[0]) == n){
      ans += y[0];
    }else{
      if(press(ans + y[1]) == n){
        ans += y[1];
      }else{
        ans += y[2];
      }
    }
    }
    return ans;
}

Compilation message

/usr/bin/ld: /tmp/ccek7xYb.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/ccWhfU28.o:combo.cpp:(.text+0xc0): first defined here
/usr/bin/ld: /tmp/ccek7xYb.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccWhfU28.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status