Submission #670687

#TimeUsernameProblemLanguageResultExecution timeMemory
670687Essa2006Combo (IOI18_combo)C++14
30 / 100
42 ms448 KiB
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl '\n'
#define FF first
#define SS second
#define all(a) a.begin(), a.end()
#define mod (ll)(1000000007)
//string s="XYYAA";
string ans="";
int press(string p);
//int press(string p){
//    int m=p.size();
//    int mx=0, cur=0;
//    for(int i=0;i<m;i++){
//        if(cur<s.size() && p[i]==s[cur])
//            cur++, mx=max(mx, cur);
//        else
//            cur=0;
//    }
//    return mx;
//}
string guess_sequence(int n){
    string a="ABXY";    
    char c;
    if(press("AB")){
        if(press("A"))
            ans.push_back('A'), c='A';
        else
            ans.push_back('B'), c='B';
    }
    else{
        if(press("X"))
            ans.push_back('X'), c='X';
        else
            ans.push_back('Y'), c='Y';
    }
    string b=a;
    a="";
    for(int i=0;i<4;i++){
        if(b[i]!=c)
            a.push_back(b[i]);
    }
    for(int i=1;i<n;i++){
        bool done=0;
        for(int j=0;j<2;j++){
            string k=ans+a[j];
            if(press(k)==i+1){
                done=1;
                ans.push_back(a[j]);
                break;
            }
        }
        if(!done)
            ans.push_back(a[2]);
    }
    return ans;
}
//int main(){
//    ios_base::sync_with_stdio(0);cin.tie(0);
//    int n=s.size();
//    cout<<guess_sequence(n);
//    
//}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...