| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 109613 | polyfish | Combo (IOI18_combo) | C++14 | 4 ms | 452 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
char C[] = {'A', 'B', 'X', 'Y'};
string S;
bool find_first_two_char(int x) {
    int tmp = press(string()+C[x]+C[x+1]);
    if (tmp==0)
        return false;
    if (tmp==1) {
        if (press(string()+C[x])==1)
            S += C[x];
        else
            S += C[x+1];
        if (press(S+C[(x+2)%4])==2)
            S += C[(x+2)%4];
        else
            S += C[(x+3)%4];
    }
    else if (tmp==2) {
        if (press(string()+C[x])==1)
            S = S + C[x] + C[x+1];
        else
            S = S + C[x+1] + C[x];
    }
    return true;
}
string guess_sequence(int N) {
    if (!find_first_two_char(0))
        find_first_two_char(2);
//    cerr << S << '\n';
    for (int i=0; i<4; ++i) {
        if (C[i]==S[0])
            swap(C[i], C[0]);
    }
    for (int i=2; i+1<N; ++i) {
//        cerr << S << '\n';
//        cerr << S+C[1]+C[1]+S+C[1]+C[2]+S+C[1]+C[3]+S+C[2]+C[1] << '\n';
        int tmp = press(S+C[1]+C[1]+S+C[1]+C[2]+S+C[1]+C[3]+S+C[2]+C[1]);
        if (tmp==i-1) {
            S[i-1] = C[2];
            S += C[1];
        }
        if (tmp==i)
            S += C[3];
        if (tmp==i+1)
            S += C[2];
        if (tmp==i+2)
            S += C[1];
    }
    int tmp = press(S+C[1]);
    if (tmp<S.size()) {
        S[N-2] = C[2];
        S += C[1];
    }
    if (tmp==S.size()+1) {
        S += C[1];
    }
    if (tmp==S.size()) {
        if (press(S+C[2])==S.size()+1)
            S += C[2];
        else
            S += C[3];
    }
    return S;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
