Submission #1092631

#TimeUsernameProblemLanguageResultExecution timeMemory
1092631rahidilbayramliCombo (IOI18_combo)C++17
0 / 100
1 ms344 KiB
#include "combo.h" #pragma GCC optimize("-O3") #include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define ll long long #define ld long double #define vl vector<ll> #define vi vector<int> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define pb push_back #define p_b pop_back #define pii pair<int, int> #define pll pair<ll, ll> #define f first #define s second using namespace std; using namespace __gnu_pbds; typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); string guess_sequence(int N) { string res = ""; int a, b, c, d, rr, bb; rr = press("AB"); if(rr == 1) { a = press("A"); if(a == 1) { b = 0; c = 0; d = 0; res = "A"; } else { b = 1; c = 0; d = 0; res = "B"; } } else { c = press("X"); if(c == 1) { a = 0; b = 0; d = 0; res = "X"; } else { a = 0; b = 0; d = 1; res = "Y"; } } string str = ""; if(!a) str += "A"; if(!b) str += "B"; if(!c) str += "X"; if(!d) str += "Y"; while((int)res.size() < N - 1) { string ask = ""; ask += res; ask += str[0]; ask += str[0]; ask += res; ask += str[0]; ask += str[1]; ask += res; ask += str[0]; ask += str[2]; ask += res; ask += str[1]; int f = press(ask); if(f == (int)(res.size())) res += str[2]; else if(f == (int)(res.size()) + 1) res += str[1]; else res += str[0]; } if((int)res.size() == N) return res; string str1 = res, str2 = res; str1 += str[0]; str2 += str[1]; int f = press(str1); if(f == (int)(str1.size())) return str1; f = press(str2); if(f == (int)(str2.size())) return str2; res += str[2]; return res; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:25:25: warning: unused variable 'bb' [-Wunused-variable]
   25 |     int a, b, c, d, rr, bb;
      |                         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...