제출 #125681

#제출 시각아이디문제언어결과실행 시간메모리
125681dragoon콤보 (IOI18_combo)C++14
100 / 100
64 ms1960 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"; remaining.erase(find(remaining.begin(), remaining.end(), now[0])); 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 < 2; i++) { if (press(now + remaining[i]) == N) return now + remaining[i]; } return now + remaining[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...