# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
421482 | Keshi | Combo (IOI18_combo) | C++17 | 41 ms | 564 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.
//In the name of God
#include<bits/stdc++.h>
#include "combo.h"
using namespace std;
typedef int ll;
typedef pair<ll, ll> pll;
const ll maxn = 2e5 + 100;
const ll mod = 1e9 + 7;
const ll inf = 1e9;
#define fast_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define Mp make_pair
#define F first
#define S second
#define Sz(x) ll((x).size())
#define all(x) (x).begin(), (x).end()
string c = "ABXY", ch;
string guess_sequence(int n){
string s, t;
ll x = press("AB");
if(x == 0){
x = press("X");
if(x) s += 'X';
else s += 'Y';
}
else{
x = press("A");
if(x) s += 'A';
else s += 'B';
}
for(ll i = 0; i < 4; i++){
if(c[i] != s[0]) ch += c[i];
}
if(n == 1) return s;
for(ll i = 1; i < n - 1; i++){
t = s;
t += ch[0];
for(ll j = 0; j < 3; j++){
t += s + ch[1] + ch[j];
}
x = press(t);
if(x == i) s += ch[2];
else if(x == i + 1){
s += ch[0];
}
else if(x == i + 2) s += ch[1];
else{
cout << 1 / 0;
return s;
}
}
t = s + ch[0];
x = press(t);
if(x == n) s += ch[0];
else{
t = s + ch[1];
x = press(t);
if(x == n) s += ch[1];
else s += ch[2];
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |