제출 #737204

#제출 시각아이디문제언어결과실행 시간메모리
737204shoryu386콤보 (IOI18_combo)C++17
100 / 100
37 ms548 KiB
#include "combo.h" #include <bits/stdc++.h> #include <stdlib.h> using namespace std; string found; int press2(string s){ return press(found + s); } int press3(vector<string> hhh){ //the 1st one will not be represented //the second one will be represented only once in a one-char //the third one will be represented with extra in a triple guess int pressed = press(found + hhh[1] + found + hhh[2] + hhh[0] + found + hhh[2] + hhh[1] + found + hhh[2] + hhh[2]); return pressed; } int ch(char hhh){ if (hhh =='A') return 0; else if (hhh == 'B') return 1; else if (hhh == 'X') return 2; else return 3; } string guess_sequence(int N) { //find first char int ca = press("AB"); if (ca >= 1){ ca = press("A"); if (ca == 1) found = "A"; else found = "B"; } else{ ca = press("X"); if (ca == 1) found = "X"; else found = "Y"; } char fc = found[0]; for (int x = 1; x < N-1; x++){ vector<string> hhh; hhh.push_back("A"); hhh.push_back("B"); hhh.push_back("X"); hhh.push_back("Y"); for (auto y = hhh.begin(); y != hhh.end(); y++) { if ((*y)[0] == fc) {hhh.erase(y); break;} } found.push_back(hhh[press3(hhh) - x][0]); } if (N != 1){ int ca = press2("A" + found + "B"); if (ca >= N){ ca = press2("A"); if (ca == N) found += "A"; else found += "B"; } else{ ca = press2("X"); if (ca == N) found += "X"; else found += "Y"; } } return found; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...