Submission #82240

#TimeUsernameProblemLanguageResultExecution timeMemory
82240mode149256Combo (IOI18_combo)C++14
100 / 100
65 ms456 KiB
/*input */ #include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> #include "combo.h" using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef complex<ld> cd; typedef pair<int, int> pi; typedef pair<ll,ll> pl; typedef pair<ld,ld> pd; typedef vector<int> vi; typedef vector<vi> vii; typedef vector<ld> vd; typedef vector<ll> vl; typedef vector<vl> vll; typedef vector<pi> vpi; typedef vector<vpi> vpii; typedef vector<pl> vpl; typedef vector<cd> vcd; typedef vector<bool> vb; typedef vector<vb> vbb; typedef string str; typedef vector<str> vs; template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; #define FOR(i, a, b) for (int i=a; i<(b); i++) #define F0R(i, a) for (int i=0; i<(a); i++) #define FORd(i,a,b) for (int i = (b)-1; i >= a; i--) #define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--) #define sz(x) (int)(x).size() #define mp make_pair #define pb push_back #define x first #define y second #define lb lower_bound #define ub upper_bound #define all(x) x.begin(), x.end() const int MOD = 1000000007; const ll INF = 1e18; const int MX = 100001; vs c = {"A", "B", "X", "Y"}; /*int press(str s){ cout << s << endl; int a; cin >> a; return a; }*/ str guess_sequence(int N){ str ats = ""; int a; int curr = 0; a = press(str(c[0] + c[1])); if(a == 2){ ats = c[0] + c[1]; c.erase(c.begin()); curr += 2; } else if(a == 1){ a = press(c[0]); if(a){ ats += c[0]; c.erase(c.begin()); } else{ ats += c[1]; c.erase(c.begin() + 1); } curr++; } else{ a = press(c[2]); if(a){ ats += c[2]; c.erase(c.begin() + 2); } else{ ats += c[3]; c.erase(c.begin() + 3); } curr++; } //for(auto u: c) cout << u << " "; //cout << endl; str aa = c[0] + c[0]; str ab = c[0] + c[1]; str ba = c[1] + c[0]; str bb = c[1] + c[1]; str ac = c[0] + c[2]; str bc = c[1] + c[2]; while(curr < N - 1){ a = press(ats + aa + ats + ab + ats + ba); a -= curr; if(!a){ ats += c[2]; curr++; } else if(a == 1){ a = press(ats + bb); a -= curr; if(!a){ ats += ac; curr += 2; } else if(a == 1){ ats += bc; curr += 2; } else if(a == 2){ ats += bb; curr += 2; } } else if(a == 2){ a = press(ats + aa); a -= curr; if(!a){ ats += ba; curr += 2; } else if(a == 1){ ats += ab; curr += 2; } else{ ats += aa; curr += 2; } } } if(curr == N - 1){ a = press(ats + c[0] + ats + c[1]); a -= curr; if(a == 1){ a = press(ats + c[0]); a -= curr; if(a){ ats += c[0]; } else{ ats += c[1]; } curr++; } else{ ats += c[2]; curr++; } } return ats; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...