Submission #1320949

#TimeUsernameProblemLanguageResultExecution timeMemory
1320949laykCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <immintrin.h>

#ifndef DEBUG
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
#endif

using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std;
//
using ld = long double;
using ll = int;
using i128 = __int128;
using ull = unsigned long long;
using pll = std::pair<ll, ll>;
using cmpl = std::complex<ld>;
template<typename T>
using oset = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;

constexpr ll MOD1 = 998244353;
constexpr ll MOD = 1000000007;
constexpr ll INV2 = 499122177;
constexpr ld PI = 3.141592653589793;
const ld eps = 1e-7;
const ll K = 3;
//const ll C = 200;

std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());

ld START_TIME = clock();

string guess_sequence(int N){
    std::string ans;
    std::string cor;
    for (int cur = 0; cur < N; cur = ans.size()) {
        ll old = ans.size();
        if (cur == 0){
            if (press("AB")){
                if (press("B")){
                    ans += 'B';
                    cor = "AXY";
                }
                else{
                    ans += 'A';
                    cor = "BXY";
                }
            }
            else{
                if (press("X")){
                    ans += 'X';
                    cor = "ABY";
                }
                else{
                    ans += 'Y';
                    cor = "BXA";
                }
            }
        }
        else if (cur == N - 1){
            if (press(ans + "AB") - old){
                if (press(ans + "B") - old){
                    ans += 'B';
                    cor = "AXY";
                }
                else{
                    ans += 'A';
                    cor = "BXY";
                }
            }
            else{
                if (press(ans + "X") - old){
                    ans += 'X';
                    cor = "ABY";
                }
                else{
                    ans += 'Y';
                    cor = "BXA";
                }
            }
        }
        else{
            char A = cor[0], B = cor[1], X = cor[2];
            int dd = press(ans + X + X + A + A);
            if (dd - old == 0){
                ans += B;
            }
            else if (dd - old == 3){
                ans += X;
            }
            else if (dd - old == 4){
                ans += X + X + A + A;
            }
            else if (dd - old == 2){
                dd = press(ans + X + X) - old;
                if (dd == 0){
                    ans += A + A;
                }
                else if (dd == 1){
                    ans += X + A;
                }
                else{
                    ans += X + X;
                }
            }
            else{
                dd = press(ans + A + X) - old;
                if (dd == 0){
                    ans += X + B;
                }
                else if (dd == 1){
                    ans += A + B;
                }
                else{
                    ans += A + X;
                }
            }
        }
    }
    return ans;
}

//signed main() {
//#ifdef DEBUG
//    std::freopen("/home/anton/CLionProjects/untitled/input.txt", "r", stdin);
//#else
//    //    std::freopen("tri.in", "r", stdin); std::freopen("tri.out", "w", stdout);
//#endif
//    std::cin.tie(nullptr)->std::ios_base::sync_with_stdio(false);
//    int tt = 1;
////    std::cin >> tt;
//    while (tt--) {
////        solve();
//    }
//#ifdef DEBUG
//    std::cerr << '\n';
//    ld TIME = (clock() - START_TIME) / CLOCKS_PER_SEC;
//    std::cerr << "Time: " << TIME << '\n';
//#endif
//}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:42:17: error: 'press' was not declared in this scope
   42 |             if (press("AB")){
      |                 ^~~~~
combo.cpp:64:17: error: 'press' was not declared in this scope
   64 |             if (press(ans + "AB") - old){
      |                 ^~~~~
combo.cpp:87:22: error: 'press' was not declared in this scope
   87 |             int dd = press(ans + X + X + A + A);
      |                      ^~~~~