# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
536404 | fuad27 | Combo (IOI18_combo) | C++17 | 45 ms | 444 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>
using namespace std;
char keys[] = {'A','B','X','Y'};
string guess_sequence(int n) {
string p = "";
for(int i = 0;i<3;i++) {
p.push_back(keys[i]);
if(press(p) == 1) {
break;
}
p.pop_back();
}
if(p.size() == 0) {
p.push_back(keys[3]);
}
vector<char> keys2;
char start = p[0];
for(int i = 0;i<4;i++) {
if(keys[i] == start)continue;
keys2.push_back(keys[i]);
}
for(int j = 1;j<n;j++) {
for(int i = 0;i<2;i++) {
if(keys2[i]==start)continue;
p.push_back(keys2[i]);
//~ cout << j << " " << p << ": " << press(p) << "\n";
if(press(p) == j+1) {
break;
}
p.pop_back();
}
if(p.size()!=j+1) {
p.push_back(keys2[2]);
}
}
//~ cout << "ans: " << p << "\n";
return p;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |