Submission #1142391

#TimeUsernameProblemLanguageResultExecution timeMemory
1142391FZ_Laabidi콤보 (IOI18_combo)C++20
100 / 100
7 ms484 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n){ string p = ""; set<string> S; S.insert("A"); S.insert("B"); S.insert("X"); S.insert("Y"); string trash = "AB"; int c = press(trash); if(c>=1){ c = press("A"); if(c==1)p+="A"; else p+="B"; } else{ c = press("X"); if(c==1)p+="X"; else p+="Y"; } if(n==1)return p; S.erase(p); // Remaining letters up to the (n-1)th int cc=0; string b,xx,y; for (auto x: S){ if (cc == 0) b = x; if (cc == 1) xx = x; if (cc == 2) y = x; cc++; } int count = 1; for(int i=0; i<n-2; i++){ string t = p+b+p+xx+y+p+xx+xx+p+xx+b; c = press(t); if(c==count)p+=y; else if(c==count+1)p+=b; else p+=xx; count++; } c = press(p+xx); if(c==n) p+=xx; else{ c = press(p+b); if(c==n)p+=b; else p+=y; } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...