Submission #1280807

#TimeUsernameProblemLanguageResultExecution timeMemory
1280807mm2302Combo (IOI18_combo)C++20
0 / 100
1 ms336 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
#include "combo.h"
using namespace std;

string guess_sequence(int n){
    string s;
    if(press("AB")==0){
        if(press("X")==0) s="Y";
        else s="X";
    } else {
        if(press("A")==0) s="B";
        else s="A";
    }
    if(n==1) return s;
    string hgh="ABXY";
    char combi, other, last;
    int var=0;
    for(int i=0;i<4;i++){
        if(hgh[i]!=s[0]){
            if(var==0) {combi=hgh[i]; var++;}
            else if(var==1){other=hgh[i]; var++;}
            else last=hgh[i];
        }
    }
    int cnt=1;
    while(true){
        int result=press(s+combi+combi+s+combi+other+s+combi+last+s+other);
        if(result-cnt==1){
            s+=last;
        } else if(result-cnt==2){
            s+=other;
        } else if(result-cnt==3){
            s+=combi;
        }
        cnt++;
        if(s.length()==n-1) break;
    }
    if(press(s+combi)==n) return s+combi;
    else if(press(s+other)==n) return s+other;
    else return s+last;
}
/*
int main() {
	int a, b, c; cin >> a >> b >> c;
	cout << "The sum of these three numbers is " << a + b + c << "\n";
}*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...