Submission #1066596

#TimeUsernameProblemLanguageResultExecution timeMemory
1066596guanexCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h"
#include<bits/stdc++.h>

using namespace std;

typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef pair<char, int> ci;
typedef pair<string, int> si;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
#define pb push_back
#define fi first
#define se second
#define whole(v) v.begin(), v.end()
#define rwhole(v) v.rbegin(), v.rend()
#define inf INT_MAX/2
#define fro front


std::string guess_sequence(int N) {
    string s;
    char fi;
    if(press("AB")){
        if(press("A")){
            fi = 'A';
        }else{
            fi = 'B';
        }
    }else{
        if(press("X")){
            fi = 'X':
        }else{
            fi = 'Y';
        }
    }
    return fi;
    s.pb(fi);
    int lc = 2;
    for(int i = 2; i < N; ++i){
        if(lc > i){
            continue;
        }
        int c;
        if(i == N-1){
            c = press(s + x);
            if(c > lc){
                s.pb(x);
            }else{
                c = press(s + y);
                if(c > lc){
                    s.pb(y);
                }else{
                    s.pb(z);
                }
            }
            break;
        }
        string a[4];
        a[0] = s + x;
        a[1] = s + y + x;
        a[2] = s + y + y;
        a[3] = s + y + z;
        c = press(a[0] + a[1] + a[2] + a[3]);
        if(c == lc){
            s.pb(z);
            lc++;
        }else if(lc + 1 == c){
            s.pb(x);
            lc++;
        }else{
            s.pb(y);
            lc++;
        }
    }
    //cout << s << endl;
    return s;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:35:21: error: expected ';' before ':' token
   35 |             fi = 'X':
      |                     ^
      |                     ;
combo.cpp:16:12: error: could not convert 'first' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   16 | #define fi first
      |            ^~~~~
      |            |
      |            char
combo.cpp:40:12: note: in expansion of macro 'fi'
   40 |     return fi;
      |            ^~
combo.cpp:49:27: error: 'x' was not declared in this scope
   49 |             c = press(s + x);
      |                           ^
combo.cpp:53:31: error: 'y' was not declared in this scope
   53 |                 c = press(s + y);
      |                               ^
combo.cpp:57:26: error: 'z' was not declared in this scope
   57 |                     s.pb(z);
      |                          ^
combo.cpp:63:20: error: 'x' was not declared in this scope
   63 |         a[0] = s + x;
      |                    ^
combo.cpp:64:20: error: 'y' was not declared in this scope
   64 |         a[1] = s + y + x;
      |                    ^
combo.cpp:66:24: error: 'z' was not declared in this scope
   66 |         a[3] = s + y + z;
      |                        ^