Submission #800139

#TimeUsernameProblemLanguageResultExecution timeMemory
800139jasminCombo (IOI18_combo)C++17
5 / 100
1 ms212 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string find_single(int n, string mom){ int l=mom.size(); string ask = ""; string ans = ""; ask = mom + "A" + mom + "B"; int coins = press(ask); if(0 < coins-l){ ask= mom + "A"; coins = press(ask); if(0 < coins-l){ ans = "A"; } else{ ans = "B"; } } else{ ask = mom + "X"; coins = press(ask); if(0 < coins-l){ ans = "X"; } else{ ans = "Y"; } } return ans; } string guess_sequence(int n) { string ans=""; ans = find_single(n, ans); set<string> opt = {"A", "B", "X", "Y"}; opt.erase(ans); string a = *opt.begin(); string b = *next(opt.begin()); string c = *next(next(opt.begin())); for(int i=1; i<n-1; i++){ string ask = ans +a +a; ask += ans + a +b; ask += ans + a +c; ask += ans + b; int coins=press(ask); if(coins == i+2){ ans += a; } else if(coins == i+1){ ans += b; } else{ ans += c; } } ans += find_single(n, ans); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...