# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
523437 | dron_rp | Combo (IOI18_combo) | C++14 | 47 ms | 320 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "combo.h"
#include <set>
#include <iostream>
using namespace std;
string guess_sequence(int N) {
string S = "";
set<char> a = {'A', 'B', 'X', 'Y'};
string p = "";
for (auto& c : a){
p = "";
p += c;
int coins = press(p);
if (coins == 1){
S += c;
a.erase(c);
break;
}
}
//cout << S << "\n";
while ((int) S.size() < N){
int idx = 1;
for (auto& c : a){
/*
if (idx >= 3) break;
p = S;
p += c;
int coins = press(p);
if (coins == (int) S.size()+1){
S += c;
break;
}
idx++;
*/
p = S;
for (int i = 0; i<N-S.size(); i++){
p += c;
}
int coins = press(p);
p = "";
if (coins > S.size()){
for (int i = 0; i<coins-S.size(); i++){
p += c;
}
S += p;
break;
}
}
//cout << idx << "\n";
//if (idx >= 3) S += *prev(a.end());
//cout << S << "\n";
}
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |