# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
788126 | APROHACK | Combo (IOI18_combo) | C++17 | 37 ms | 456 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"
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;
std::string guess_sequence(int N) {
string p = "";
string posi = "ABXY";
string ans = "";
char comienza;
string newPosi = "";
int best = 0, res = 0;
for(int j = 0 ; j < 3 ; j ++){
p = ans;
p+= posi[j];
int coin = press(p);
if(coin > res){
res = coin;
best = j;
}
}
if(res == 0)best = 3;
ans += posi[best];
for(auto i : posi)if(i != posi[best])newPosi += i;
//for (auto i : newPosi)cout << i << endl;
for(int i = 1 ; i < N ; i ++){
best = 0, res = 0;
for(int j = 0 ; j < 2 ; j ++){
p = ans;
p+= newPosi[j];
int coin = press(p);
if(coin > res){
res = coin;
best = j;
if(res == i + 1)break;
}
}
if(res != i + 1){
best = 2;
}
ans += newPosi[best];
}
//cout << ans << endl;
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |