Submission #867391

#TimeUsernameProblemLanguageResultExecution timeMemory
867391gutzzyCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "grader.cpp"
using namespace std;

string guess_sequence(int n){
    string ans = "";
    string guess = "";
    int ret;
    vector<char> chars(3);
    // adivino el primero
    ret = press("AB");
    if (ret>=1){
        ret = press("A");
        if(ret==1){
            ans += 'A';
            chars[0] = 'B';
        }
        else{
            ans += 'B';
            chars[0] = 'A';
        }
        chars[1] = 'X';
        chars[2] = 'Y';
    }
    else{
        chars[0] = 'A';
        chars[1] = 'B';
        ret = press("X");
        if(ret==1){
            ans += 'X';
            chars[2] = 'Y';
        }
        else{
            ans += 'Y';
            chars[2] = 'X';
        }
    }
    
    // adivino el resto
    for(int pos=2;pos<n+1;pos++){
        guess = ans + chars[0] + ans + chars[1] + chars[0] + ans + chars[1] + chars[1] + ans + chars[1] + chars[2];
        ret = press(guess);
        if(ret==pos) ans += chars[0];
        else if(ret==pos+1) ans += chars[1];
        else ans += chars[2];
    }
    
    cout << ans << endl;
    
    return 0;
}

Compilation message (stderr)

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