Submission #951113

# Submission time Handle Problem Language Result Execution time Memory
951113 2024-03-21T07:12:05 Z star Combo (IOI18_combo) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using  namespace std;

string guess_sequence(int n)
{
    string p = "", ans = "" ;
    char a, b, c, d;
    if (press("AB") > 0 )
    {
        c = 'X', d = 'Y' ;
        press("A")? (a = 'A', b = 'B') : (a = 'B', b = 'A');
    }
    else
    {
        c = 'A', d = 'B' ;
        press("X")? (a = 'X', b = 'Y') : (a = 'Y', b = 'X');
    }
    ans=a;
    if (n == 1) return ans;
    for (int i=1; i<n-1; ++ i)
    {
        p = ans + b + b + ans + b + c + ans + b + d + ans + c;
        int bk = press(p);
        if (bk == i + 0 ) ans += d;
        if (bk == i + 1 ) ans += c;
        if (bk == i + 2 ) ans += b;
    }
    if (press(ans + b) == n) ans += b;
    else  if (press(ans + c) == n) ans += c;
    else ans += d;
    return ans;
}

Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:9: error: 'press' was not declared in this scope
    8 |     if (press("AB") > 0 )
      |         ^~~~~
combo.cpp:23:18: error: 'press' was not declared in this scope
   23 |         int bk = press(p);
      |                  ^~~~~
combo.cpp:28:9: error: 'press' was not declared in this scope
   28 |     if (press(ans + b) == n) ans += b;
      |         ^~~~~