# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1007102 | devariaota | Combo (IOI18_combo) | C++17 | 27 ms | 2020 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 <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "combo.h"
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define fi first
#define se second
#define endl '\n'
template <typename T>
using ordered_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
int n;
string guess_sequence(int n){
string p = "AB", s = "";
if(press(p)){
p = "A";
if(press(p)) s += p;
else s += "B";
} else {
p = "X";
if(press(p)) s += p;
else s += "Y";
}
if(n == 1) return s;
vector<char> ch;
if(s[0] != 'A') ch.push_back('A');
if(s[0] != 'B') ch.push_back('B');
if(s[0] != 'X') ch.push_back('X');
if(s[0] != 'Y') ch.push_back('Y');
while(s.length() + 2 <= n){
p = "";
for(int i = 0; i < 3; i++){
p += s;
p += ch[0];
p += ch[i];
}
p += s;
p += ch[1];
int tmp = press(p);
if(tmp == s.length() + 2){
s += ch[0];
} else if(tmp == s.length() + 1){
s += ch[1];
} else {
s += ch[2];
}
}
p = "";
p += s;
p += ch[0];
p += s;
p += ch[1];
if(press(p) == n){
p = s + ch[0];
if(press(p) == n){
s += ch[0];
} else {
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... |