Submission #1002481

#TimeUsernameProblemLanguageResultExecution timeMemory
1002481zh_hCombo (IOI18_combo)C++17
100 / 100
22 ms1868 KiB
#include <bits/stdc++.h>
#define lint long long
#define pb push_back
#define mp make_pair
using namespace std;

// int press(string p){
//     int temp;
//     cin >> temp;
//     return temp;
// }

int press(string s);

string guess_sequence(int n){
    string one, two, three;

    string ans;

    string s1 = "A", s2 = "B", s3 = "X", s4 = "Y";

    //* find first letter
    if(press(s1+s2) > 0){
        if(press(s2) == 1){ans = s2; one = s1; two = s3; three = s4;}
        else{ans = s1; one = s2; two = s3; three = s4;}
    }
    else{
        if(press(s3) == 1){ans = s3; one = s4; two = s1; three = s2;}
        else{ans = s4; one = s1; two = s2; three = s3;}
    }

    if(n == 1){return ans;}
    else{
        int cur = 1;
        while(cur < n-1){
            int temp = press(ans+one + ans+two+one + ans+two+two + ans+two+three);

            if(temp == cur){ans+=three;}
            else if(temp == cur+1){ans+=one;}
            else{ans+=two;}

            cur++;
        }

        if(press(ans+one + ans+two) != n){
            return ans+three;
        }
        else if(press(ans+one) != n){
            return ans+two;
        }
        else return ans+one;
    }

}


// int main() {
//     ios_base::sync_with_stdio(false);
//     cin.tie(NULL);

    
//     return 0;
// }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...