# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199755 | detaomega | Combo (IOI18_combo) | C++14 | 70 ms | 436 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>
#include "combo.h"
using namespace std;
char used[4] = {'A', 'B', 'X', 'Y'};
string guess_sequence(int N) {
string ans;
int Not;
int tmp = 3;
int val;
for(int i=0; i<3; i++) {
val = press(ans + used[i]);
if(val) {
Not = i;
ans += used[i];
break;
}
}
if(val == 0) {
Not = 3;
ans += 'Y';
val = 1;
}
vector<char> vt;
for(int i=0; i<4; i++) {
if(i == Not) continue;
vt.push_back(used[i]);
}
for(int i=1; i<N; i++) {
bool fg = 0;
for(int j=0;j<vt.size()-1; j++) {
int cmp = press(ans + vt[j]);
if(cmp > val) {
fg = 1;
val++;
ans+=vt[j];
break;
}
}
if(fg==0) {
ans+=vt.back();
val++;
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |