제출 #792524

#제출 시각아이디문제언어결과실행 시간메모리
792524Sohsoh84Combo (IOI18_combo)C++17
97 / 100
33 ms592 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define debug(x) cerr << #x << ": " << x << endl; #define sep ' ' int n; string TC[4] = {"A", "B", "X", "Y"}; inline int tpress(string s) { //cerr << "press: " << s << endl; return press(s); } string guess_sequence(int N_) { int n = N_; string ans = TC[3]; for (int i = 0; i < 3; i++) if (tpress(TC[i])) ans = TC[i]; vector<string> C; for (int i = 0; i < 4; i++) if (TC[i] != ans) C.push_back(TC[i]); if (n == 1) return ans; for (int j = 0; j < n - 2; j++) { string tans = ans + C[0] + ans + C[1] + C[0] + ans + C[1] + C[1] + ans + C[1] + C[2]; int score = tpress(tans); if (score == j + 1) ans += C[2]; else if (score == j + 2) ans += C[0]; else ans += C[1]; } for (int i = 0; i < 2; i++) if (tpress(ans + C[i]) == n) return ans + C[i]; return ans + C[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...