# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
76506 | darthsidious | Combo (IOI18_combo) | C++14 | 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 <iostream>
#include <string>
//A B X Y
using namespace std;
int press(string p);
// {
// string secret = "ABXYXXYY";
// int ans = 0;
// for(int i=0;i<secret.size();i++) {
// if(secret[i] == p[i])
// ans++;
// else
// break;
// }
// return ans;
// }
string guess_sequence(int N) {
string chars = "ABXY";
string c[3];
int start_c = 3;
for(int i=0;i<3;i++) {
string tmp(1, chars[i]);
int r = press(tmp);
if(r == 1) {
start_c = i;
break;
}
}
for(int i=0;i<3;i++) {
if(start_c <= i)
c[i] = string(1, chars[i+1]);
else
c[i] = string(1, chars[i]);
}
// cout << (string)c << endl;
string ans(1, chars[start_c]);
// cout << "Starting with " << ans << endl;
for(int i=0;i<7996;i++) {
int correct = ans.size();
string test = ans + c[0] + ans + c[1] + c[0] + ans + c[1] + c[1] + ans + c[1] + c[2];
int res = press(test);
if(res == correct)
ans += c[2];
else if(res == correct + 1)
ans += c[0];
else if(res == correct + 2)
ans += c[1];
// cout << "testing " << test << endl;
if(ans.size() == N)
break;
// if(i > N)
// break;
// while(true) { //construct test string
// for(int j=0;j<3;j++) {
// test += ans + c[j];
// }
// }
}
return ans;
}
// int main() {
// cout << guess_sequence(8) << endl;
// }
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |