Submission #666344

#TimeUsernameProblemLanguageResultExecution timeMemory
666344NursikPassword (RMI18_password)C++14
0 / 100
15 ms308 KiB
#include <stdio.h> #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; #define ll long long #define pb push_back #define mp make_pair int query(string str); pair<int, string> combine(string a, string b){ string ans = ""; int i = 0, j = 0; int n = (int)a.size(), m = (int)b.size(); int cl = m; while (i < n && j < m){ string cur = ""; cur += ans; cur += a[i]; for (int pos = j; pos < m; ++pos){ cur += b[pos]; } int kek = query(cur); if (cl + 1 == kek){ ans += a[i++]; } else{ ans += b[j++]; } cl += 1; } for (int pos = j; pos < m; ++pos){ ans += b[pos]; } for (int pos = i; pos < n; ++pos){ ans += a[pos]; } return mp(n + m, ans); } string guess(int n, int s){ multiset<pair<int, string>> setik; for (int i = 0; i < s; ++i){ string q = ""; char ch = 'a'; ch += i; for (int j = 0; j < n; ++j){ q += ch; } int kek = query(q); string w = ""; for (int j = 1; j <= kek; ++j){ w += ch; } if (kek){ setik.insert(mp(kek, w)); } } while (setik.size() != 1){ pair<int, string> cur = *setik.begin(); setik.erase(setik.find(cur)); pair<int, string> cur2 = *setik.begin(); setik.erase(setik.find(cur2)); pair<int, string> ncur = combine(cur.second, cur2.second); setik.insert(ncur); } pair<int, string> ans = *setik.begin(); return ans.second; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...