제출 #750541

#제출 시각아이디문제언어결과실행 시간메모리
750541xink콤보 (IOI18_combo)C++14
5 / 100
1 ms252 KiB
#include "combo.h" #include <iostream> #include <vector> #include <utility> #include <sstream> #include <climits> #include <cstring> #define ll long long #define ld long double using namespace std; const ll mod = 1e9 + 7; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; void get_first_letter(string &str, string &letter) { if (press("AB") > 0) { if (press("A") > 0) { str.push_back('A'); } else { str.push_back('B'); swap(letter[0], letter[1]); } } else { if (press("X") > 0) { str.push_back('X'); swap(letter[0], letter[2]); } else { str.push_back('Y'); swap(letter[0], letter[3]); } } } void get_last_letter(string &str, string &letter) { if (press(str + letter[1]) == (int)str.size() + 1) { str.push_back(letter[1]); } else if (press(str + letter[2]) == (int)str.size() + 1) { str.push_back(letter[2]); } else { str.push_back(letter[3]); } } string guess_sequence(int n) { string ans, letter = "ABXY"; get_first_letter(ans, letter); for (int i = 1; i < n - 1; i++) { int coin = press(ans + letter[1] + ans + letter[2] + letter[1] + ans + letter[2] + letter[2] + ans + letter[2] + letter[3]); if (coin == i) { ans.push_back(letter[3]); } else if (coin == i + 1) { ans.push_back(letter[1]); } else { ans.push_back(letter[2]); } } get_last_letter(ans, letter); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...