Submission #1143077

#TimeUsernameProblemLanguageResultExecution timeMemory
1143077jadai007Combo (IOI18_combo)C++20
10 / 100
20 ms572 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;
/*
int N;
string S;

int press(string p){
  int len = p.length();
  int coins = 0;
  for (int i = 0, j = 0; i < len; ++i) {
    if (j < N && S[j] == p[i]) {
      ++j;
    } else if (S[0] == p[i]) {
      j = 1;
    } else {
      j = 0;
    }
    coins = max(coins, j);
  }
  return coins;
}
*/


string guess_sequence(int N){
    string ans = "";
    bool back = true;
    while(ans.size() < N){
        if(back){
            string ck1 = ans + 'A';
            string ck2 = ans + 'B';
            string ck3 = ans + 'X';
            string ck4 = ans + 'Y';
            if(press(ck1) == ck1.size()) ans += 'A';
            else if(press(ck2) == ck2.size()) ans += 'B';
            else if(press(ck3) == ck3.size()) ans += 'X';
            else if(press(ck4) == ck4.size()) ans += 'Y';
            else back = false;
        }
        if(!back){
            string ck1 = 'A' + ans;
            string ck2 = 'B' + ans;
            string ck3 = 'X' + ans;
            string ck4 = 'Y' + ans;
            if(press(ck1) == ck1.size()) ans = ck1;
            else if(press(ck2) == ck2.size()) ans = ck2;
            else if(press(ck3) == ck3.size()) ans = ck3;
            else if(press(ck4) == ck4.size()) ans = ck4;
        }
    }
    return ans;
    
}

/*int main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    cin >> N >> S;
    cout << guess_sequence(N);
    
}*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...