제출 #778701

#제출 시각아이디문제언어결과실행 시간메모리
778701Minindu206콤보 (IOI18_combo)C++14
97 / 100
32 ms532 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int n) { vector<string> cont; string seq; int cc = press("AB"); if(cc) { if(press("A")) seq = "A"; else seq = "B"; } else { if(press("X")) seq = "X"; else seq = "Y"; } for (auto c : {"A", "B", "X", "Y"}) if (c != seq) cont.push_back(c); if(n == 1) return seq; for (int i = 1; i < n - 1; i++) { string cpress = seq + cont[0] + seq + cont[1] + cont[0] + seq + cont[1] + cont[1] + seq + cont[1] + cont[2]; int cur = press(cpress) - i; if(cur == 1) seq += cont[0]; else if(cur == 2) seq += cont[1]; else seq += cont[2]; } for(auto c:cont) if(press(seq + c) == n) { seq += c; break; } return seq; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...