제출 #113375

#제출 시각아이디문제언어결과실행 시간메모리
113375Akashi콤보 (IOI18_combo)C++14
100 / 100
47 ms576 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N){ int n = N, x; string s; set <char> let; let.insert({'A', 'B', 'X', 'Y'}); char ch = 0; x = press(s + 'A' + s + 'B'); if(x >= 1){ x = press(s + 'A'); if(x == 0) ch = 'B'; else ch = 'A'; } else{ x = press(s + 'X'); if(x == 0) ch = 'Y'; else ch = 'X'; } s.push_back(ch); if(n == 1) return s; let.erase(ch); // cerr << ch; set <char> :: iterator it = let.begin(); char A, B, C; A = *it; ++it; B = *it; ++it; C = *it; for(int i = 2; i < n ; ++i){ int x = press(s + A + s + B + A + s + B + B + s + B + C); if(x == i - 1) { s.push_back(C); // cerr << C; } else if(x == i){ s.push_back(A); // cerr << A; } else if(x == i + 1){ s.push_back(B); // cerr << B; } } ch = 0; x = press(s + 'A' + s + 'B'); if(x == n){ x = press(s + 'A'); if(x == n - 1) ch = 'B'; else ch = 'A'; } else{ x = press(s + 'X'); if(x == n - 1) ch = 'Y'; else ch = 'X'; } // cerr << ch; // cerr << endl; s.push_back(ch); return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...