# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1024169 | ksu2009en | Combo (IOI18_combo) | C++17 | 1 ms | 596 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 <vector>
#include <string>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <cstring>
#include <unordered_map>
using namespace std;
typedef long long ll;
#include "combo.h"
//int press(string p){
//
// return 0;
//}
string guess_sequence(int n){
string ans;
if(press("A"))
ans = "A";
else if(press("B"))
ans = "B";
else if(press("X"))
ans = "X";
else
ans = "Y";
vector<string> vec, v = {"A", "B", "X", "Y"};
for(auto i: v)
if(i != ans)
vec.push_back(i);
for(int i = 1; i <= n - 2; i++){
string res = ans + vec[0];
res += ans + vec[1] + vec[0];
res += ans + vec[1] + vec[1];
res += ans + vec[1] + vec[2];
ll c = press(res);
if(c == ans.size() + 1)
ans += vec[0];
else if(c == ans.size() + 2)
ans += vec[1];
else
ans += vec[2];
}
string res = ans + vec[0];
if(press(res) == n)
ans += vec[0];
else{
res = ans + vec[1];
if(press(res) == n)
ans += vec[1];
else
ans += vec[2];
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |