Submission #1136863

#TimeUsernameProblemLanguageResultExecution timeMemory
1136863njoop콤보 (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

string guess_sequence(int n) {
    char f, a, b, c;
    int val;
    string ans, t;
    val = press("AB");
    if(val) {
        a = 'X';
        b = 'Y';
        val = press("A");
        f = (val ? 'A' : 'B');
        c = (!val ? 'A' : 'B');
    } else {
        a = 'A';
        b = 'B';
        val = press("X");
        f = (val ? 'X' : 'Y');
        c = (!val ? 'X' : 'Y');
    }
    ans.push_back(f);
    for(int i=2; i<n; i++) {
        t.clear();
        t += ans + a + b;
        t += ans + a + c;
        t += ans + b;
        val = press(t);
        if(val == i+1) {
            ans.push_back(a);
        }  else if(val == i) {
            ans.push_back(b);
        } else {
            ans.push_back(c);
        }
    }
    val = press(ans + a);
    if(val == n) return ans + a;
    val = press(ans + b);
    if(val == n) return ans + b;
    return ans + c;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:11: error: 'press' was not declared in this scope
    9 |     val = press("AB");
      |           ^~~~~