Submission #532190

#TimeUsernameProblemLanguageResultExecution timeMemory
532190ohohorzCombo (IOI18_combo)C++14
97 / 100
39 ms588 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { 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; if(N==1) return s; // 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...