Submission #1117419

#TimeUsernameProblemLanguageResultExecution timeMemory
1117419blackslexCombo (IOI18_combo)C++17
30 / 100
85 ms1472 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string s = ""; vector<char> c{'A', 'B', 'X', 'Y'}; multiset<char> ms; bool f = 0; for (auto &e: c) ms.emplace(e); char x; while (ms.size() > 1) { char e = *ms.begin(); ms.erase(ms.begin()); string p; p.push_back(e); if (press(p)) {x = e; f = 1; break;} } if (!f) x = *ms.begin(); s = string(1, x); auto pos = find(c.begin(), c.end(), x); c.erase(pos, pos + 1); for (int i = 2; i <= N; i++) { ms.clear(); for (auto &e: c) ms.emplace(e); f = 0; while (ms.size() > 1) { char e = *ms.begin(); ms.erase(ms.begin()); string p = s; p.push_back(e); if (press(p) == i) {x = e; f = 1; break;} } if (!f) x = *ms.begin(); s.push_back(x); } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...