Submission #1142061

#TimeUsernameProblemLanguageResultExecution timeMemory
1142061jokerCombo (IOI18_combo)C++17
10 / 100
15 ms456 KiB
#include "combo.h"
#include <unordered_set>
#include <unordered_map>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <iomanip>
#include <numeric>

using namespace std;
std::string guess_sequence(int N) {
  string S = "";
  vector<char> btns = {'X','Y','B','A'};
  int frstidx = -1;
  while (S.length() != N) {
    if (S.length() == 0) {
        for (size_t i = 0; i < 4; i++) {
            string st;
            st += btns[i];
            int coin = press(st);
            if (coin == 1) {
                frstidx = i;
                S += btns[i];
                break;
            }
        }
    } else {
        for (size_t i = 0; i < 4; i++) {
            if (i != frstidx) {
                string st = S+btns[i];
                int coin = press(st);
                if (coin == S.length()+1) {
                    S += btns[i];
                    break;
                }
            }
        }
    }
  }
  return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...