제출 #254952

#제출 시각아이디문제언어결과실행 시간메모리
254952jainbot27콤보 (IOI18_combo)C++17
100 / 100
44 ms732 KiB
#include <bits/stdc++.h> #include <combo.h> using namespace std; #define nl endl string global = ""; // int press(string x){ // int a = 0; // int ans = 0; // for(char c : x){ // if(global[a] == c){ // a++; // ans = max(a, ans); // } // else{ // a = 0; // } // } // cerr << x << " " << ans << endl; // return ans; // } string t[] = {"A", "B", "X", "Y"}; string guess_sequence(int n){ string ret; string f=""; if(press("AB")){ if(press("A")) f += "A"; else f+= "B"; } else{ if(press("X")) f += "X"; else f+="Y"; } vector<string> want; for(int i = 0; i < 4; i++){ if(t[i] != f){ want.push_back(t[i]); } } ret = f; if(n == 1){ return ret; } for(string x : want){ cerr << x<< " "; } cerr << nl; for(int i = 0; i < n-2; i++){ string query = ""; query += ret + want[0] + ret + want[1] + want[0] + ret + want[1] + want[2] + ret + want[1] + want[1]; int res = press(query); if(res == (int)ret.size()) ret += want[2]; else if(res == (int)ret.size() + 1) ret += want[0]; else ret += want[1]; } if(press(ret + want[0])==n) ret += want[0]; else if(press(ret + want[1]) == n) ret += want[1]; else ret += want[2]; return ret; } // void run(int n, string c){ // global = c; // cout << guess_sequence(n); // } // int main(){ // run(5, "XYYYY"); // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...