Submission #76363

#TimeUsernameProblemLanguageResultExecution timeMemory
76363RezwanArefin01Combo (IOI18_combo)C++17
100 / 100
54 ms584 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std; 

vector<string> c = {"A", "B", "X", "Y"}; 

string guess_sequence(int N) {
    int first = -1;
    if(press("AB")) {
        if(press("A")) first = 0;
        else first = 1; 
    } else if(press("X")) first = 2; 
    else first = 3;
    
    string ans = c[first]; 
    c.erase(c.begin() + first); 

    for(int i = 1; i < N - 1; i++) {
        string s = ans+c[0]+c[0]+ans+c[0]+c[1]+ans+c[0]+c[2]+ans+c[1];  
        int x = press(s); 
        if(x == i + 2) ans += c[0];
        else if(x == i+1) ans += c[1]; 
        else ans += c[2]; 
    }
    if(N > 1) {     
        if(press(ans+c[0]) == N) ans += c[0];
        else if(press(ans + c[1]) == N) ans += c[1] ;
        else ans += c[2];
    }
    return ans; 
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...