# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
526663 | lcs147 | 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
using namespace std;
// string s;
// int cnt = 0;
// int press(string p) {
// int res = 0;
// for(int i=0; i<p.size(); i++) {
// for(int t=1; t<=s.size() && i+t<=p.size(); t++) {
// if(s.substr(0, t) == p.substr(i, t)) {
// res = max(res, t);
// }
// }
// }
// cnt++;
// return res;
// }
string guess_sequence(int n) {
set<char> possible = {'A','B','X','Y'};
string res;
while(res.size() < n) {
for(char c:possible) {
if(press(res+c) == res.size()+1) {
res += c;
if(res.size() == 1) {
possible.erase(c);
}
break;
}
}
}
return res;
}
// int32_t main(){
// ios_base::sync_with_stdio(false);
// cin.tie(0);
// #define endl '\n'
// s = "X";
// vector<char> possible = {'A','B','Y'};
// while(s.size() < 100) s += possible[rand()%3];
// cout << s << endl;
// cout << guess_sequence(s.size()) << endl;
// cout << cnt << endl;
// return 0;
// }