Submission #1332113

#TimeUsernameProblemLanguageResultExecution timeMemory
1332113feyzaCombo (IOI18_combo)C++20
30 / 100
9 ms484 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

unordered_set<string>el;

string guess_sequence(int N)
{
    el.insert("A");
    el.insert("B");
    el.insert("X");
    el.insert("Y");

    string s;
    for(string i : el)
    {
        if(press(i)==1)
        {
            s=i;
            break;
        }
    }

    el.erase(el.find(s));
    int lastsz=1;
    string curr,ask;

    while(lastsz!=N)
    {
        for(string nxt : el)
        {
            curr=s;
            ask="";
            for(int j=1;j<=4 && lastsz+j<=N;j++)
            {
                curr+=nxt;
                ask+=curr;
            }

            int ret=press(ask);

            if(ret>lastsz)
            {
                for(int i=lastsz+1;i<=ret;i++)
                    s+=nxt;
                lastsz=s.size();

                break;
            }
        }
    }

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