# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
433584 | Apiram | Combo (IOI18_combo) | C++14 | 99 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"
using namespace std;
std::string guess_sequence(int N) {
int counts=0;
string p;
string k = "ABXY";
for (int i =0;i<4;++i){
if (press(p+k[i])>counts){
counts++;
p+=k[i];
k.erase(i,1);
break;
}
}
set<string>pos;
for (int i =0;i<3;++i){
for (int j =0;j<3;++j){
for (int l =0;l<3;++l){
string b;
b+=k[i];
b+=k[j];
b+=k[l];
pos.insert(b);
}
}
}
while(p.length()<N-3){
for (auto c:pos){
int cost =press(p+c);
if (cost-counts==3){
counts+=3;
p+=c[0];
p+=c[1];
p+=c[2];
break;
}
}
}
while(p.length()<N){
for (auto c:k)
if (press(p+c)>counts){
counts++;
p+=c;
break;
}
}
return p;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |