Submission #988697

#TimeUsernameProblemLanguageResultExecution timeMemory
988697MighilonCombo (IOI18_combo)C++17
0 / 100
1 ms344 KiB
#include <bits/stdc++.h>
#include <combo.h>
using namespace std;
 
#ifdef DEBUG
#include "../Library/debug.h"
#else
#define dbg(x...)
// #define cin fin
// #define cout fout
// const string FILE_NAME = ""; ifstream fin(FILE_NAME + ".in"); ofstream fout(FILE_NAME + ".out");
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl; 
 
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) for (int i = 0; i < (a); ++i)
#define FORd(i, a, b) for (int i = (b) - 1; i >= (a); --i)
#define F0Rd(i, a) for (int i = (a) - 1; i >= 0; --i)
#define trav(a, x) for (auto& a : x)
#define f first 
#define s second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
 
const char nl = '\n';
const int INF = 1e9;
const int MOD = 1e9 + 7;
 
string guess_sequence(int n){
    string s = "";
    string d = "ABXY";
    bool dv[4];
    F0R(i, 3){
        if(press(string(1, d[i]))){
            dv[i] = true;
            s.pb(d[i]);
            break;
        }
    }
    if(sz(s) == 0){
        s.pb(d[3]);
        dv[3] = true;
    }
    FOR(i, 1, n){
        string aux = s;
        F0R(j, 4){
            if(dv[j] == false){
                aux.pb(d[j]);
                break;
            }
        }
 
        bool fir = true;
        char x;
        F0R(j, 4){
            if(dv[j] == false && fir){
                fir = false;
                continue;
            }
            else if(dv[j] == false){
                x = d[j];
            }
        }
        F0R(j, 4){
            if(dv[j] == false){
                aux += s;
                aux.pb(x);
                aux.pb(dv[j]);
            }
        }
        int nr = press(aux);
        if(i + 2 == nr){
            F0R(j, 4){
                if(dv[j] == false){
                    s.pb(d[j]);
                    break;
                }
            }
        }
        else if(i + 3 == nr){
            bool fi = true;
            F0R(j, 4){
                if(dv[j] == false && fi){
                    fi = false;
                    continue;
                }
                if(dv[j] == false){
                    s.pb(d[j]);
                    break;
                }
            }
        }
        else{
            F0Rd(j, 4){
                if(dv[j] == false){
                    s.pb(d[j]);
                    break;
                }
            }
        }
    }
    return s;
}
 
/*
void solve(){
}
 
int32_t main(){
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    
    int TC = 1;
    // cin >> TC;
    while(TC--){
        solve();
    }
    return 0;
}
 
*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...