Submission #1052185

#TimeUsernameProblemLanguageResultExecution timeMemory
1052185khanhtbCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define pf push_front
#define vi vector<ll>
#define vii vector<vi>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define all(a) a.begin(), a.end()
#define fi first
#define se second
using namespace std;
const ll mod = 1e9+7; 
const ll inf = 2e18;
const ll B = 320;
const ll N = 1e5+8;
string ans = "";
int press(string p){
    cout << p << '\n';
    int rep; cin >> rep;
    return rep;
}
vector<char> bt = {'A','B','X','Y'};
string guess_sequence(int N){
    int fid = 0;
    if(press("AB")){
        if(press("A")) fid = 0;
        else fid = 1;
    }
    else{
        if(press("X")) fid = 2;
        else fid = 3;
    }
    ans += bt[fid];
    while(ans.size() < N){
        int i1 = -1, i2 = -1, i3 = -1;
        for(int i = 0; i < 4; i++){
            if(i == fid) continue;
            if(i1 == -1) i1 = i;
            else if(i2 == -1) i2 = i;
            else i3 = i;
        }
        int rep = press(ans + bt[i1] + bt[i2] + bt[i3] + ans + bt[i2] + bt[i3] + ans + bt[i3]);
        if(rep == ans.size()+1) ans += bt[i3];
        else if(rep == ans.size()+2) ans += bt[i2], ans += bt[i3];
        else ans += bt[i1], ans += bt[i2], ans += bt[i3];
    }
    return ans;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   38 |     while(ans.size() < N){
      |           ~~~~~~~~~~~^~~
combo.cpp:47:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |         if(rep == ans.size()+1) ans += bt[i3];
      |            ~~~~^~~~~~~~~~~~~~~
combo.cpp:48:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |         else if(rep == ans.size()+2) ans += bt[i2], ans += bt[i3];
      |                 ~~~~^~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cccZ1SvU.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/ccxRIeDS.o:combo.cpp:(.text+0xc0): first defined here
collect2: error: ld returned 1 exit status