제출 #532196

#제출 시각아이디문제언어결과실행 시간메모리
532196ohohorz콤보 (IOI18_combo)C++14
100 / 100
36 ms632 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { if(N == 1){ string gg = "ABX"; char fi = 'Y'; for(char c:gg){ string p; p += c; // cout <<"inside " << p << "\n"; if(press(p) == 1){ fi = c; break; } } string s = ""; s += fi; return s; } string s =""; char fi; if(press("AB")>0){ if(press("A")==1) fi = 'A'; else fi = 'B'; }else{ if(press("X")==1) fi = 'X'; else fi = 'Y'; } s += fi; // cout << fi << "\n"; // <= 3 queries used // left : = n - 1 // 3 + n - 2 = n-1 used set<char> lol; lol.insert('A'); lol.insert('B'); lol.insert('X'); lol.insert('Y'); lol.erase(fi); vector<char> lmao; for(char c:lol) lmao.push_back(c); for(int i = 1;i < N-1;i ++){ string p; p += s; p += lmao[0]; p += lmao[0]; p += s; p += lmao[0]; p += lmao[1]; p += s; p += lmao[0]; p += lmao[2]; p += s; p += lmao[1]; // p += lmao[0]; // cout <<p<<" "; int coins = press(p); // cout << coins<<endl; if(coins == i){ s += lmao[2]; }else if(coins==(i+1)){ s += lmao[1]; }else{ assert(coins==(i+2)); s += lmao[0]; } } char lst = lmao.back(); for(int i = 0;i<2;i++){ string p; p += s; p += lmao[i]; if(press(p) == N){ lst = lmao[i]; break; } } s+=lst; return s; } /* s+c1+c1 s+c1+c2 s+c1+c3 s+c2+c1 if coins = 0: s += c3 elif coins == 1: s += c2 else: s += c1 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...