제출 #125664

#제출 시각아이디문제언어결과실행 시간메모리
125664dragoon콤보 (IOI18_combo)C++14
0 / 100
3 ms264 KiB
#include "combo.h" #include<string> #include <assert.h> #include <iostream> #include <algorithm> using namespace std; string FindFirstChar() { if (press("AB")) { if (press("A")) return "A"; else return "B"; } if (press("X")) return "X"; return "Y"; } string guess_sequence(int N) { string now = FindFirstChar(); if (N == 1) return now; string remaining = "ABXY"; cout << now << "\n"; remaining.erase(find(remaining.begin(), remaining.end(), now[0])); cout << remaining << "\n"; assert(remaining.size() == 3); for (int i = 2; i < N; i++) { string current = (now + remaining[0]) + (now + remaining[1] + remaining[0]) + (now + remaining[1] + remaining[1]) + (now + remaining[1] + remaining[2]); int coin = press(current); if (coin == i - 1) now.push_back(remaining[2]); else if (coin == i) now.push_back(remaining[0]); else now.push_back(remaining[1]); } for (int i = 0; i < 3; i++) { if (press(now + remaining[i]) == N) return now + remaining[i]; } return ""; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...