# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
534400 | MrDeboo | Combo (IOI18_combo) | C++17 | 1 ms | 200 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 <bits/stdc++.h>
// #define int long long
using namespace std;
std::string guess_sequence(int n) {
srand(time(NULL));
char f[]={'A','B','X','Y'};
string s;
bool bl=0;
for(auto &i:f){
string g;
g+=i;
if(press(g)!=0){bl=1;s+=i;break;}
if(i=='X')break;
}
if(!bl)s+='Y';
vector<char>ve;
for(auto &i:f)if(i!=s[0])ve.push_back(i);
vector<char>v=ve;
int cnt=0;
while(s.size()!=n){
bool bl=0;
vector<bool>pick(3);
map<char,bool>mp;
for(int w=0;w<2;w++){
string G;
while(G.size()<4*n)G+=ve[rand()%3];
int k=press(s+G);
cnt++;
for(int i=0;i<k;i++){
s+=G[i];
}
mp[G[k]]=1;
}
if(!bl)s+=v.back();
vector<char>V;
for(auto i:ve)if(!mp[i])V.push_back(i);
ve=V;
}
return s;
// std::string p = "";
// for (int i = 0; i < 4 * N; ++i) {
// p += 'A';
// }
// int coins = press(p);
// std::string S = "";
// for (int i = 0; i < N; ++i) {
// S += 'A';
// }
// return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |