# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
380826 | knightron0 | Combo (IOI18_combo) | C++14 | 47 ms | 568 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;
// string S;
// int press(string p) {
// int coins = 0;
// for (int i = 0, j = 0; i < p.size(); ++i) {
// if (j < S.size() && S[j] == p[i]) {
// ++j;
// } else if (S[0] == p[i]) {
// j = 1;
// } else {
// j = 0;
// }
// coins = max(coins, j);
// }
// cout<<p.size()<<' '<<S.size()*4<<' '<<coins<<endl;
// return coins;
// }
string guess_sequence(int N){
string tmp = "ABXY";
string done = "";
// first letter
if(press("AB") >= 1){
if(press("A") >= 1){
done += "A";
tmp = "BXY";
} else {
done += "B";
tmp = "AXY";
}
} else {
if(press("X") >= 1){
done += "X";
tmp = "ABY";
} else {
done += "Y";
tmp = "ABX";
}
}
while(done.size() < N-1){
int exp = done.size()+1;
string query = done + tmp[0] + done + tmp[1] + tmp[0] + done + tmp[1] + tmp[1] + done + tmp[1] + tmp[2];
int q = press(query);
if(q == exp){
done += tmp[0];
} else if(q == exp+1){
done += tmp[1];
} else {
done += tmp[2];
}
}
if(done.size() == N){
return done;
}
string query = done + tmp[0];
if(press(query) == N){
done += tmp[0];
return done;
}
query = done + tmp[1];
if(press(query) == N){
done += tmp[1];
return done;
}
done += tmp[2];
return done;
}
// signed main() {
// ios_base::sync_with_stdio(false);
// cin.tie(NULL);
// // #ifdef LOCAL
// // freopen("input.txt", "r", stdin);
// // #endif
// cin>>S;
// cout<<guess_sequence(S.size())<<endl;
// return 0;
// }
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |