Submission #971496

#TimeUsernameProblemLanguageResultExecution timeMemory
971496__Davit__Combo (IOI18_combo)C++17
10 / 100
26 ms1716 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 (to_string(x) != answer)combo.pb(x); } for (int i = 0; i < N - 1; i++) { davit::shuffle(combo); for (int j = 0; j < (int) combo.size(); j++) { if (j == (int) combo.size() - 1) { answer += combo[j]; break; } string tmp = answer + combo[j]; int pts = press(tmp); if (pts == (int) tmp.size()) { answer += combo[j]; break; } } } return answer; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...