Submission #971551

#TimeUsernameProblemLanguageResultExecution timeMemory
971551__Davit__Combo (IOI18_combo)C++17
100 / 100
16 ms2140 KiB
#include<bits/stdc++.h> #include "combo.h" #define ll long long #define ld long double #define ff first #define ss second #define pb push_back #define vr(v) v.begin(),v.end() #define rv(v) v.rbegin(),v.rend() //mt19937 myrand(373); using namespace std; namespace davit { mt19937 myrand(chrono::steady_clock::now().time_since_epoch().count()); ll RANDOM(ll l, ll r) { ll res = myrand() % (r - l + 1) + l; return res; } void shuffle(vector<char> &a) { for (int i = 0; i < (int) a.size(); i++) { int idx = RANDOM(0, (int) a.size() - 1); swap(a[i], a[idx]); } } }; string guess_sequence(int N) { int coins = press("AB"); string answer; if (coins) { if (press("A"))answer = "A"; else answer = "B"; } else { if (press("X"))answer = "X"; else answer = "Y"; } vector<char> combo; for (char x: {'A', 'B', 'X', 'Y'}) { if (x != answer[0])combo.pb(x); } for (int i = 1; i < N - 1; i++) { string tmp1 = answer + combo[0]; string tmp2 = answer + combo[1] + combo[0]; string tmp3 = answer + combo[1] + combo[1]; string tmp4 = answer + combo[1] + combo[2]; string tmp = tmp1 + tmp2 + tmp3 + tmp4; int pts = press(tmp); if (pts == i + 1) { answer = tmp1; } else if (pts == i + 2) { answer = answer + combo[1]; } else { answer = answer + combo[2]; } } if (N == 1) return answer; if (press(answer + combo[0]) == (int) (answer + combo[0]).size())answer = answer + combo[0]; else if (press(answer + combo[1]) == (int) (answer + combo[1]).size())answer = answer + combo[1]; else answer = answer + combo[2]; return answer; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...