Submission #776884

#TimeUsernameProblemLanguageResultExecution timeMemory
776884Durza42Combo (IOI18_combo)C++14
10 / 100
43 ms464 KiB
#include <iostream> #include <vector> #include "combo.h" #define endl '\n' #define ll long long int using namespace std; #define BRUTFORCE2 #ifdef BRUTFORCE string guess_sequence(int N) { vector<char> LETTERS = { 'A', 'B', 'X', 'Y' }; string S = "."; for(auto&& l : LETTERS) { S[0] = l; if(press(S) > 0) break; } for(int i = 1 ; i < N ; ++i) { S += "."; for(auto&& l : LETTERS) { if(l == S[0]) continue; S[i] = l; if(press(S) == i + 1) break; } } return S; } #endif /**************************/ #ifdef BRUTFORCE2 string guess_sequence(int N) { vector<char> LETTERS = { 'A', 'B', 'X', 'Y' }; string S = "."; for(auto&& l : LETTERS) { S[0] = l; if(press(S) > 0) break; } for(int i = 1 ; i < N ; ++i) { int nb_seen = 0; S += "."; for(int j = 0 ; j < int(LETTERS.size()) ; ++j) { if(LETTERS[j] == S[0]) continue; if(nb_seen == 2) { if(LETTERS[j] == S[0]) ++i; S[i] = LETTERS[j]; break; } S[i] = LETTERS[j]; if(press(S) == i + 1) break; nb_seen++; } } return S; } #endif
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...