Submission #1174851

#TimeUsernameProblemLanguageResultExecution timeMemory
1174851somefolkCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <complex>
#include <list>
#include <cassert>
#include <chrono>
#include <random>
#include <stack>
#include <iomanip>
#include <fstream>
using namespace std;

#define endl "\n"
// #define int long long

const int INF = 1e9+7;
const int MOD = 1e9+7;

// int press(string p){cout << p << " "; int nr; cin >> nr; return nr;};
int press(string p);

string guess_sequence(int n){
    string sol;
    vector<char> ops;
    if(press("A") == 1){sol+='A'; ops = {'B', 'X', 'Y'};}
    else if(press("B") == 1){sol+='B'; ops = {'A', 'X', 'Y'};}
    else if(press("X") == 1){sol+='X'; ops = {'A', 'B', 'Y'};}
    else {sol+="Y"; ops = {'A', 'B', 'X'};}

    while(sol.size() < n){
        // randomize:
        // random_device rd;
        // mt19937 g(rd());
        // shuffle(ops.begin(), ops.end(), g);

        int ans1 = press(sol + string(n, ops[0]));
        if(ans1 != sol.size()){
            sol += string(ans1 - sol.size(), ops[0]);
            continue;
        }
        int ans2 = press(sol + string(n, ops[1]));
        if(ans2 != sol.size()){
            sol += string(ans2 - sol.size(), ops[1]);
            continue;
        }
        int ans3 = press(sol + string(n, ops[2]));
        sol += string(ans3 - sol.size(), ops[2]);
    }

    return sol;
}

int32_t main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    cout << guess_sequence(5) << endl;

    return 0;
}

Compilation message (stderr)

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