Submission #1142765

#TimeUsernameProblemLanguageResultExecution timeMemory
1142765xcalimarCombo (IOI18_combo)C++20
100 / 100
7 ms480 KiB
#include <bits/stdc++.h> #include "combo.h" #define REP(i, a, b) for(int i = a; i<b; i++) #define all(v) v.begin(), v.end() #define i64 long long using namespace std; const i64 MOD = 1000000007; string guess_sequence(int n){ //char a = 'A', b = 'B', x = 'X', y = 'Y'; vector<string> a = {"A", "B", "X", "Y"}; vector<string> c; string s = ""; string f = ""; string test = "AB"; int ans = press(test); if(ans == 0){ ans = press("X"); if(ans == 0){ s += 'Y'; f += 'Y'; } else{ s += 'X'; f += 'X'; } } else{ ans = press("A"); if(ans == 0){ s += 'B'; f += 'B'; } else{ s += 'A'; f += 'A'; } } if(n==1)return s; REP(i, 0, a.size()){ if(a[i] == f) continue; c.push_back(a[i]); } string t = ""; while(s.size() < n-1){ t += s + c[1]; REP(i, 0, 3){ t += s + c[0] + c[i]; } ans = press(t); if(ans == s.size()){ s += c[2]; } else if(ans == s.size()+1){ s += c[1]; } else if(ans == s.size()+2){ s += c[0]; } t.clear(); } test = s + c[0]; ans = press(test); if(ans == n){ s+=c[0]; return s; } test = s + c[1]; ans = press(test); if(ans == n){ s+=c[1]; return s; } return s+c[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...