Submission #1250345

#TimeUsernameProblemLanguageResultExecution timeMemory
1250345ubormaciCombo (IOI18_combo)C++20
10 / 100
15 ms460 KiB
#include <iostream>
#include <algorithm> // for sort, mainly
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <array>
#include <string>
#include <cstdio>
#include <iterator>
#include <unordered_set>
#include <cstdint> // for int64_t, int32_t, etc
#include <queue>
#include <stack>
#include <deque>
#include <numeric> // gcd, lcm
#include <fstream>
#include <bitset> // for bitset
#include <iomanip>
#include <cassert> // for set with custom ordering
#include <type_traits> // for set with custom ordering
#include <utility> // for swap, forward, etc
using namespace std;

#pragma GCC optimize("O2")
// #pragma GCC optimize("O1","O2","O3","Ofast","unroll-loops")
//#pragma GCC target("sse","sse2","sse3","sse4.1","sse4.2","avx","avx2","fma")

template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cout << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cout << ' ' << H; dbg_out(T...); }
#ifdef LOCAL
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

#include "combo.h"

typedef int ll;

/*

string answer = "";

int press(string p) {

    ll ret = 0;

    for(ll i = 1; i <= answer.length(); i++) {

        string check = answer.substr(0, i);

        if(i > p.length()) {
            break;
        }

        for(ll j = 0; j < p.length() - i + 1; j++) {

            string to = p.substr(j, i);
            if(check == to) {
                ret = i;
            }
        }
    }

    return ret;

}
*/

string guess_sequence(int N) {

    ll n = N;

    string ans = "";
    // a lenyeg az, hogy hatarozzuk meg, melyik a legelso karakter

    ll first = -1;

    vector<string> v(4, "A");
    v[0] = "A";
    v[1] = "B";
    v[2] = "X";
    v[3] = "Y";

    for(ll i = 0; i < 4; i++) {
        //cerr << "\ni=" << i;
        ll g = press(v[i]);

        //cerr << "\ntemp=" << v[i];

        if(g == 1) {
            first = i;
            ans += v[i];
            break;
        }
    }

    //cerr << "\nfirst=" << first;
    //cerr << "\nans=" << ans;

    for(ll i = 2; i <= n; i++) {

        for(ll j = 0; j < 4; j++) {

            if(j == first) {
                continue;
            }

            string temp = ans + v[j];

            ll g = press(temp);
            if(g == i) {
                ans = temp;
                break;
            }
        }
    }

    return ans;

}

/*

int main() {

    cin >> answer;

    //cout << press("X");
    //return 0;

    string ret = guess_sequence(answer.length());

    cout << ret;

}
*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...