# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
788194 | APROHACK | Combo (IOI18_combo) | C++17 | 1 ms | 296 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;
break;
}
}
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-1 ; i ++){
best = 0, res = 0;
p = ans;
p+=newPosi[0];
for(int j = 0 ; j < 3 ; j ++){
p += ans;
p += newPosi[1];
p += newPosi[j];
}
int coin = press(p);
//cout << " got " << coin << endl;
if(coin == i){
ans += newPosi[2];
}else if(coin == i+1){
ans += newPosi[0];
}else{
ans += newPosi[1];
}
}
p = ans;
p += newPosi[0];
if(press(p) == N){
return ans + newPosi[0];
}
p = ans;
p+= newPosi[1];
if(press(p) == N){
return ans + newPosi[1];
}
//cout << ans << endl;
return ans + newPosi[2];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |