Submission #1136867

#TimeUsernameProblemLanguageResultExecution timeMemory
1136867njoop콤보 (IOI18_combo)C++20
0 / 100
6 ms472 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { char f, a, b, c; int val; string ans, t; val = press("AB"); if(val) { a = 'X'; b = 'Y'; val = press("A"); f = (val ? 'A' : 'B'); c = (!val ? 'A' : 'B'); } else { a = 'A'; b = 'B'; val = press("X"); f = (val ? 'X' : 'Y'); c = (!val ? 'X' : 'Y'); } ans.push_back(f); for(int i=2; i<n; i++) { t.clear(); t += ans + a + b; t += ans + a + c; t += ans + b; val = press(t); if(val == i+1) { ans.push_back(a); } else if(val == i) { ans.push_back(b); } else { ans.push_back(c); } } if(n == 1) { return ans; } val = press(ans + a); if(val == n) return ans + a; val = press(ans + b); if(val == n) return ans + b; return ans + c; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...