Submission #1199506

#TimeUsernameProblemLanguageResultExecution timeMemory
1199506AMel0nCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define FOR(i,N) for(ll i = 0; i < N; i++)
#define all(x) (x).begin(), (x).end()
#define F first 
#define S second

#include "combo.h"

string guess_sequence(int N) {
    string s;
    string buton; // hehe guanhan 🫡
    if (press("AB") >= 1) {
        if (press("A") == 1) {
            s = "A";
            buton = "BXY";
        } else {
            s = "B";
            buton = "AXY";
        }
    } else {
        if (press("X") == 1) {
            s = "X";
            buton = "ABY";
        } else {
            s = "Y";
            buton = "ABX";
        }
    }
    if (N == 1) return s;
    for (int i = 0; i < N-1; i++) {
        int res = press(s+buton[0]  +  s+buton[1]+buton[0]  +  s+buton[1]+buton[1]  +  s+buton[1]+buton[2]);
        if (res == s.size()) s += buton[2];
        if (res == s.size()+1) s += buton[0];
        if (res == s.size()+2) s += buton[1];
    }
    if (press(s+buton[0]) == s.size()+1) {
        s += buton[0];
    } else {
        if (press(s+buton[1]) == s.size()+1) s += buton[1];
        else s += buton[2];
    }
    return s;

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:45:14: error: expected '}' at end of input
   45 |     return s;
      |              ^
combo.cpp:12:30: note: to match this '{'
   12 | string guess_sequence(int N) {
      |                              ^