Submission #101644

#TimeUsernameProblemLanguageResultExecution timeMemory
101644loliconCombo (IOI18_combo)C++14
5 / 100
3 ms220 KiB
#include "combo.h"
#include<algorithm>
std::string guess_sequence(int N){
    std::string s, p, c = {"ABXY"};
    int i,j,t,coin = 0;
    if(press("AB")){
        if(press("A"))
            s+= 'A', std::swap(c[0],c[3]);
        else
            s+= 'B', std::swap(c[1],c[3]);
    } else {
        if(press("X"))
            s+= 'X', std::swap(c[2],c[3]);
        else
            s+= 'Y';
    } coin++;

    for(i=1;i<N-1;i++){
        t = press(s+c[0]+s+c[1]+c[2]+s+c[1]+c[1]+s+c[1]+c[0]) - coin;
        if(t == 1){
            s+=c[0];
        } else if(t == 2){
            s+=c[1];
        } else {
            s+=c[2];
        }
        coin++;
    }
    if(press(s+c[0])==coin+1) s+=c[0];
    else if(press(s+c[1])==coin+1) s+=c[1];
    else s+=c[2];
    return s;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:5:11: warning: unused variable 'j' [-Wunused-variable]
    5 |     int i,j,t,coin = 0;
      |           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...