Submission #921328

#TimeUsernameProblemLanguageResultExecution timeMemory
921328AverageAmogusEnjoyerCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> bool cmin(T &i, T j) { return i > j ? i=j,true:false; }
template<class T> bool cmax(T &i, T j) { return i < j ? i=j,true:false; }
/*
string W = "ABXYY";
int sz = 5;
int press(string p) {
    for (int i=1;i<=sz;i++) {
        if (p.find(W.substr(0,i)) == string::npos) {
            return i-1;
        }
    }
    return sz;
}
*/
string guess_sequence(int n) {
    string res = "";
    vector<string> v = {"A","B","X","Y"};
    string F;
    for (auto &x: v) {
        if (press(x) == 1) {
            F = x;
            break;
        }
    }
    res += F;
    for (int i=2;i<=n;i++) {
        for (auto &x: v) {
            if (x != F && press(res+x) == i) {
                res += x;
                break;
            }
        }
    }
    return res;
}
/*
int main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr);
    cout << guess_sequence(sz) << endl;    
}
*/

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:13: error: 'press' was not declared in this scope; did you mean 'res'?
   23 |         if (press(x) == 1) {
      |             ^~~~~
      |             res
combo.cpp:31:27: error: 'press' was not declared in this scope; did you mean 'res'?
   31 |             if (x != F && press(res+x) == i) {
      |                           ^~~~~
      |                           res