제출 #1021425

#제출 시각아이디문제언어결과실행 시간메모리
1021425elipsen콤보 (IOI18_combo)C++17
5 / 100
0 ms344 KiB
#include "combo.h" using namespace std; #define str string #define p press str guess_sequence(int N) { str S[4] = {"A", "B", "X", "Y"}; // Part 1: Determine the first letter (2) int initCombo = p("XYX") >= 1 ? 2 : 0; if (initCombo) {initCombo += p("XAXBXY") <= 1 ? 1 : 0;} else {initCombo += p("AXAYAB") <= 1 ? 1 : 0;} int lenCombo = 1; str combo = S[initCombo]; for (int Si = initCombo; Si < 3; Si++) {S[Si] = S[Si + 1];} // Part 2: Determine letters between the first and last, if any (1 per) str query; int lenQuery; while (lenCombo < N - 1) { query = combo + S[0] + S[0] + combo + S[0] + S[1] + combo + S[0] + S[2] + combo + S[1]; lenQuery = p(query); if (lenQuery == lenCombo + 2) {combo += S[0];} else if (lenQuery == lenCombo + 1) {combo += S[1];} else {combo += S[2];} lenCombo += 1; } // Part 3: Determine the last letter when necessary (2) if (lenCombo == N) {return combo;} else { if (p(combo + S[0]) == N) {return (combo + S[0]);} else if (p(combo + S[1]) == N) {return (combo + S[1]);} else {return (combo + S[2]);} } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...