# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
913838 | stefanneagu | Combo (IOI18_combo) | C++17 | 15 ms | 2096 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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
//int press(string p) {
//int x;
//cin >> x;
//return x;
//}
string guess_sequence(int n) {
// primul char
set<string> s;
s.insert("A");
s.insert("B");
s.insert("X");
s.insert("Y");
string primul = "";
for(auto it : s) {
if(it == "Y") {
primul = it;
break;
}
if(press(it) == 1) {
primul = it;
break;
}
}
s.erase(primul);
// primul e primul char
string ans = primul;
string add = "";
vector<string> v;
for(auto it : s) {
v.push_back(it);
}
for(int i = 2; i < n; i ++) {
string apel = ans;
apel += v[0];
apel += ans;
apel += v[1];
apel += v[2];
apel += ans;
apel += v[1];
apel += v[1];
apel += ans;
apel += v[1];
apel += v[0];
int x = press(apel);
if(x == i - 1) {
ans += v[2];
} else if(x == i) {
ans += v[0];
} else if(x == i + 1) {
ans += v[1];
} else {
assert("ce se" == "intampla");
}
}
if(n == 1) {
return ans;
}
for(auto it : v) {
string apel = ans;
apel += it;
if(it == v[2]) {
return apel;
}
if(press(apel) == n) {
return apel;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |