제출 #76362

#제출 시각아이디문제언어결과실행 시간메모리
76362RezwanArefin01콤보 (IOI18_combo)C++17
5 / 100
1 ms284 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std; 

string guess_sequence(int N) {
    vector<string> c = {"A", "B", "X", "Y"}; 
    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(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...