제출 #115393

#제출 시각아이디문제언어결과실행 시간메모리
115393kitoha콤보 (IOI18_combo)C++14
97 / 100
62 ms576 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; char key[] = { 'A','B','X','Y' }; string s; string guess_sequence(int N) { char element[3]; int pos = 0; int idx = 0; if (press("AB")) { if (press("A")) { s = "A"; idx = 0; } else { s = "B"; idx = 1; } } else { if (press("XY")) { if (press("X")) { s = "X"; idx = 2; } else { s = "Y"; idx = 3; } } } if (N == 1) return s; for (int i = 0; i <= 3; i++) { if (idx == i) continue; element[pos++] = key[i]; } for(int i=1;i<=N-2;i++){ int cnt = press(s + element[0] + element[0] + s + element[0] + element[1] + s + element[0] + element[2] + s + element[1]); int cur = s.size(); if (cnt == cur + 2) s = s + element[0]; else if (cnt == cur + 1) s = s + element[1]; else s = s + element[2]; } if (press(s + element[0]) ==N ) s = s + element[0]; else if (press(s + element[1]) == N) s = s + element[1]; else s = s + element[2]; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...