Submission #722489

#TimeUsernameProblemLanguageResultExecution timeMemory
722489BobonbushCombo (IOI18_combo)C++17
10 / 100
68 ms544 KiB
#include <bits/stdc++.h> #include "combo.h" #define foreach for #define in : using namespace std; typedef long long ll; const int MODULO = 12; template<class X , class Y> bool Maximize(X &x , Y y) { if(x < y) { x = y; return true; } return false; } template<class X ,class Y> bool Minimize(X &x , Y y) { if(x > y) { x = y; return true; } return false; } template<class X ,class Y> void Add(X &x , Y y) { x += y; if(x >= MODULO) x-= MODULO; } template<class X ,class Y> void Sub(X & x , Y y) { x -= y; if(x < 0 ) x += MODULO; } char dict[] = {'A' , 'B' , 'X' , 'Y'}; string guess_sequence(int n) { set<int>lefts; for(int i = 0 ; i < 4 ; i++) { lefts.insert(i); } string p = ""; for(int i = 0 ; i < 4 ; i++ ) { p += dict[i]; if(press(p)) { lefts.erase(i); break; } p.pop_back(); } bool rights = true; int maxx = 1; while(rights) { rights = false; foreach(int index in lefts) { p += dict[index]; if(Maximize(maxx , press(p))) { rights = true; break; } p.pop_back(); } } while((int)p.size() != n) { continue; } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...