Submission #1116940

#TimeUsernameProblemLanguageResultExecution timeMemory
1116940tuandqCombo (IOI18_combo)C++17
100 / 100
46 ms1644 KiB
#include <bits/stdc++.h> using namespace std ; int press(std::string p); string guess_sequence(int n) { vector<string> a = {"A", "B", "X", "Y"} ; string res = "", h = "" ; if(press(a[0] + a[1])) { h = (press(a[0]) ? a[0] : a[1]) ; } else { h = (press(a[2]) ? a[2] : a[3]) ; } a.erase(find(a.begin(), a.end(), h)) ; res += h ; for(int i = 1; i < n; i ++) { // cerr << i << ' ' ; if(i == n - 1) { if(press(res + a[0]) == i + 1) res += a[0] ; else res += (press(res + a[1]) == i + 1 ? a[1] : a[2]) ; break ; } int x = press(res+a[0]+a[0] + res+a[0]+a[1] + res+a[1]+a[0]) ; if(x == i) { res += a[2] ; continue ; } if(x == i + 1) { int y = press(res + a[1] + a[1]) ; if(y == i) { res += a[0] + a[2] ; } else if(y == i + 1) { res += a[1] + a[2] ; } else { res += a[1] + a[1] ; } } else { int y = press(res + a[0] + a[0]) ; if(y == i) { res += a[1] + a[0] ; } else if(y == i + 1) { res += a[0] + a[1] ; } else { res += a[0] + a[0] ; } } ++ i ; } return res ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...