Submission #394225

#TimeUsernameProblemLanguageResultExecution timeMemory
394225jsannemoPassword (RMI18_password)C++14
50 / 100
1433 ms20368 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; int query(string q); vector<int> seen(26); string go(const string& pre, int N, int S) { if (S < 0) return ""; string q = pre + string(N - sz(pre), 'a' + S); int cnt = query(q) - seen[S] - sz(pre); cerr << "pre " << pre << " S " << S << " cnt " << cnt << endl; string res; for (int i = cnt; i >= 0; --i) { string npre = pre; rep(j,0,i) npre.push_back('a' + S); if (i != cnt) { res.insert(res.begin(), 'a' + S); seen[S]++; } res = go(npre, N, S - 1) + res; } return res; } string guess(int N, int S) { return go("", N, S - 1); }
#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...