Submission #666326

#TimeUsernameProblemLanguageResultExecution timeMemory
666326NursikPassword (RMI18_password)C++14
80 / 100
1131 ms456 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 s second #define f first #define mp make_pair int ix[30], adx[10000]; int query(string str); string guess(int n, int s){ string ans = ""; vector<pair<int, int>> vec; for (int i = 0; i < s; ++i){ string kek = ""; char ch = 'a'; ch += i; for (int j = 1; j <= n; ++j){ kek += ch; } ix[i] = query(kek); vec.pb(mp(ix[i], i)); } sort(vec.begin(), vec.end()); for (int i = 0; i < s; ++i){ int jj = vec[i].s; char ch = 'a'; ch += jj; int len = 0; len = (int)ans.length(); string nans = ""; for (int j = 0; j <= len && ix[jj] > 0; ++j){ string add = ""; int is = 1; while (ix[jj] > 0){ add += ch; string q = ""; for (int k = 0; k < j; ++k){ q += ans[k]; } q += add; for (int k = j; k < len; ++k){ q += ans[k]; } if ((int)q.length() > n) break; int kek = query(q); if (kek == len + is){ is += 1; adx[j] += 1; ix[jj] -= 1; } else{ break; } } } for (int j = 0; j <= len; ++j){ while (adx[j] > 0){ nans += ch; adx[j] -= 1; } if (j < len){ nans += ans[j]; } } ans = nans; } return ans; }
#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...