Submission #963832

# Submission time Handle Problem Language Result Execution time Memory
963832 2024-04-15T18:55:29 Z Hezov Combo (IOI18_combo) C++17
0 / 100
0 ms 344 KB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N)
{
    string s = "";///Empty string.
    ///Find first character.
    if(press("AB"))
    {
        if(press("A"))
            s+="A";
        else s+="B";
    }
    else
    {
        if(press("X"))
            s+="X";
        else s+="Y";
    }
    ///First character found.
    char choices[3];
    int poz = 0;
    if(s[0]!='A')
        choices[poz++] = 'A';
    if(s[0]!='B')
        choices[poz++] = 'B';
    if(s[0]!='X')
        choices[poz++] = 'C';
    if(s[0]!='Y')
        choices[poz++] = 'Y';
    ///Now we have all the choices.
    for(int i = 2;i<N;i++)
    {
        string p=""; ///sA        sBA
        p =s + choices[0] + s + choices[1] + choices[0];
        /// sBB
        p = s + choices[1] + s + choices[1];
        /// sBC
        p = s + choices[1] + choices[2];
        if(press(p)==i)
            s+=choices[0];
        else if(press(p)==i+1)
            s+=choices[1];
        else s+=choices[2];
    }
    ///Now we need the last letter.
    if(press(s+choices[0])==N)
        s+=choices[0];
    else if(press(s+choices[1])==N)
        s+=choices[1];
    else s+=choices[2];
    return s;
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong Answer: wrong guess.
2 Halted 0 ms 0 KB -