# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1111439 | epicci23 | Combo (IOI18_combo) | C++17 | 0 ms | 0 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 int long long
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;
vector<char> v;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int ask(string s,int ekle){
s.push_back(v[ekle]);
return press(s);
}
string guess_sequence(int n){
string res="";
if(press("A")==1){ // OPTIMIZE HERE!!!
res.push_back('A');
v.push_back('B');
v.push_back('X');
v.push_back('Y');
}
else{
v.push_back('A');
if(press("B")==1){
res.push_back('B');
v.push_back('X');
v.push_back('Y');
}
else{
v.push_back('B');
if(press("X")==1){
res.push_back('X');
v.push_back('Y');
}
else{
res.push_back('Y');
v.push_back('X');
}
}
}
for(int i=1;i<n;i++){
if(i==n-1){
bool ok=0;
shuffle(all(v),rng);
for(int j=0;j<2;j++){
if(ask(res,j)==i+1){
res.push_back(v[j]);
ok=1;
break;
}
}
if(!ok) res.push_back(v.back());
}
else{
string Query="";
for(int i=0;i<3;i++){
Query+=res;
Query.push_back(v[0]);
Q.push_back(v[i]);
}
Query+=res;
Query.push_back(v[1]);
int hm = press(Query);
if(hm==i) res.push_back(v[2]);
else if(hm==i+1) res.push_back(v[1]);
else res.push_back(v[0]);
}
}
return res;
}
/*void _(){
}
int32_t main(){
cin.tie(0); ios::sync_with_stdio(0);
int tc=1;//cin >> tc;
while(tc--) _();
return 0;
}*/