제출 #154417

#제출 시각아이디문제언어결과실행 시간메모리
154417andreiomd콤보 (IOI18_combo)C++11
0 / 100
2 ms220 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

string guess_sequence (int N)
{
    string S;

    char V[4] = {'A', 'B', 'X', 'Y'};

    vector < int > A;

    for(int i = 1; i <= N; ++i)
    {
        if(i == 1)
        {
            int Ret = 0;

            for(int j = 0; j < 3; ++j)
            {
                S.push_back(V[j]);

                if(press(S) == i)
                {
                    Ret = j;

                    break;
                }
                else
                    S.pop_back();
            }

            if(!S.size())
            {
                S.push_back(V[3]);

                Ret = 3;
            }

            for(int j = 0; j < 4; ++j)
                if(j != Ret)
                    A.push_back(j);
        }
        else
        {
            for(int j = 0; j < 2; ++j)
            {
                S.push_back(V[A[j]]);

                if(press(S) == i)
                    break;
                else
                    S.pop_back();
            }

            if((int)S.size() != i)
                S.push_back(A[V[2]]);
        }
    }

    return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...