Submission #1000800

#TimeUsernameProblemLanguageResultExecution timeMemory
1000800c2zi6Combo (IOI18_combo)C++14
100 / 100
24 ms1844 KiB
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define all(a) (a).begin(), (a).end() #define replr(i, a, b) for (int i = int(a); i <= int(b); ++i) #define reprl(i, a, b) for (int i = int(a); i >= int(b); --i) #define rep(i, n) for (int i = 0; i < int(n); ++i) #define mkp(a, b) make_pair(a, b) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<PII> VPI; typedef vector<VI> VVI; typedef vector<VVI> VVVI; typedef vector<VPI> VVPI; typedef pair<ll, ll> PLL; typedef vector<ll> VL; typedef vector<PLL> VPL; typedef vector<VL> VVL; typedef vector<VVL> VVVL; typedef vector<VPL> VVPL; template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;} template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;} #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<class T> using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #include "combo.h" string guess_sequence(int n) { string s; if (press("AB")) { if (press("A")) s.pb('A'); else s.pb('B'); } else { if (press("X")) s.pb('X'); else s.pb('Y'); } if (n == 1) return s; string ret = s; if ('A' != s[0]) s.pb('A'); if ('B' != s[0]) s.pb('B'); if ('X' != s[0]) s.pb('X'); if ('Y' != s[0]) s.pb('Y'); rep(i, n-2) { string qr; qr += ret; qr.pb(s[1]); qr += ret; qr.pb(s[2]); qr.pb(s[1]); qr += ret; qr.pb(s[2]); qr.pb(s[2]); qr += ret; qr.pb(s[2]); qr.pb(s[3]); int cnt = press(qr)-ret.size(); if (cnt == 0) ret.pb(s[3]); else if (cnt == 1) ret.pb(s[1]); else if (cnt == 2) ret.pb(s[2]); /*cout << "CURRENT GUESS: " << ret << endl;*/ } ret.pb(s[1]); if (press(ret) == n) return ret; ret.pop_back(); ret.pb(s[2]); if (press(ret) == n) return ret; ret.pop_back(); ret.pb(s[3]); return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...