Submission #1029669

#TimeUsernameProblemLanguageResultExecution timeMemory
1029669AmirAli_H1Combo (IOI18_combo)C++17
5 / 100
1 ms344 KiB
// In the name of Allah #include <bits/stdc++.h> #include "combo.h" using namespace std; typedef long long int ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef complex<ld> cld; #define all(x) (x).begin(),(x).end() #define len(x) ((ll) (x).size()) #define F first #define S second #define pb push_back #define sep ' ' #define endl '\n' #define Mp make_pair #define kill(x) cout << x << '\n', exit(0) #define set_dec(x) cout << fixed << setprecision(x); #define file_io(x,y) freopen(x, "r", stdin); freopen(y, "w", stdout); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int maxn = 2000 + 4; int n; string res; string guess_sequence(int Nx) { n = Nx; if (press("AB") >= 1) { if (press("A") >= 1) res += "A"; else res += "B"; } else { if (press("X") >= 1) res += "X"; else res += "Y"; } vector<char> ls; for (char ch : {'A', 'B', 'X', 'Y'}) { if (ch != res[0]) ls.pb(ch); } for (int i = 1; i < n - 1; i++) { string s = ""; s += res; s += ls[0]; s += res; s += ls[1]; s += ls[0]; s += res; s += ls[1]; s += ls[1]; s += res; s += ls[1]; s += ls[2]; int x = press(s); if (x == len(res) + 1) res += ls[0]; else if (x == len(res) + 2) res += ls[1]; else res += ls[2]; } if (press(res + ls[0]) == n) res += ls[0]; else if (press(res + ls[1]) == n) res += ls[1]; else res += ls[2]; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...