# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
645022 | Nursik | Combo (IOI18_combo) | C++14 | 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 "combo.h"
#include <iostream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <bitset>
#include <random>
using namespace std;
#define ll long long
#define pb push_back
const ll maxn = 2e3 + 1;
int used[maxn][4];
vector<char> v = {'A', 'B', 'X', 'Y'};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string guess_sequence(int n) {
string pref = "";
int get = press("AB");
if (get > 0){
get = press("A");
if (get == 1){
pref += "A";
}
else{
pref += "B";
}
}
else{
get = press("X");
if (get == 1){
pref += "X";
}
else{
pref += "Y";
}
}
vector<char> v2;
for (auto it : v){
if (it != pref[0]){
v2.pb(it);
}
}
for (int i = 1; i < n; ++i){
for (int j = 0; j < 3; ++j){
int k = rng() % (j + 1);
swap(v2[j], v2[k]);
}
int ans = 2;
for (int j = 0; j < 2; ++j){
string npref = pref + v2[j];
get = press(npref);
if (get == i + 1){
ans = j;
break;
}
}
pref += v2[ans];
}
return pref;
}