// Hallelujah, praise the one who set me free
// Hallelujah, death has lost its grip on me
// You have broken every chain, There's salvation in your name
// Jesus Christ, my living hope
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define RREP(i, s, e) for (int i = (s); i >= (e); i--)
template <class T>
inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;}
template <class T>
inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;}
typedef long long ll;
typedef long double ld;
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> iii;
#define ALL(_a) _a.begin(), _a.end()
#define SZ(_a) (int) _a.size()
#define pb push_back
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<iii> viii;
#ifndef DEBUG
#define cerr if (0) cerr
#endif
const int INF = 1000000005;
const ll LINF = 1000000000000000005ll;
const int MAXN = 5005;
int query(string str);
int occ[30];
int pos[30][MAXN];
string guess(int n, int s) {
REP (c, 0, s) {
string str(n, 'a' + c);
occ[c] = query(str);
}
REP (i, 0, s) {
REP (j, 0, n) {
pos[i][j] = 0;
}
}
REP (l, 0, s) {
REP (r, 0, s) {
if (l == r) {
continue;
}
int ptr = occ[r];
auto make = [&] (int x, int y) {
string s = "";
REP (i, 0, x) {
s += l + 'a';
}
REP (i, 0, y) {
s += r + 'a';
}
return s;
};
REP (i, 1, occ[l] + 1) {
while (ptr >= 1 && query(make(i, ptr)) != i + ptr) {
ptr--;
}
pos[l][i - 1] += occ[r] - ptr;
}
}
}
string ans(n, '?');
REP (c, 0, s) {
REP (i, 0, occ[c]) {
ans[pos[c][i] + i] = 'a' + c;
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
336 KB |
Guessed the password with 226 queries. |
2 |
Correct |
5 ms |
336 KB |
Guessed the password with 530 queries. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Guessed the password with 95 queries. |
2 |
Correct |
5 ms |
208 KB |
Guessed the password with 262 queries. |
3 |
Correct |
3 ms |
208 KB |
Guessed the password with 336 queries. |
4 |
Correct |
6 ms |
208 KB |
Guessed the password with 581 queries. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
210 ms |
336 KB |
Guessed the password with 19205 queries. |
2 |
Correct |
327 ms |
336 KB |
Guessed the password with 34674 queries. |
3 |
Correct |
407 ms |
464 KB |
Guessed the password with 43495 queries. |
4 |
Incorrect |
405 ms |
464 KB |
Could not guess the password with 50000 queries. |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
336 KB |
Guessed the password with 226 queries. |
2 |
Correct |
5 ms |
336 KB |
Guessed the password with 530 queries. |
3 |
Correct |
1 ms |
208 KB |
Guessed the password with 95 queries. |
4 |
Correct |
5 ms |
208 KB |
Guessed the password with 262 queries. |
5 |
Correct |
3 ms |
208 KB |
Guessed the password with 336 queries. |
6 |
Correct |
6 ms |
208 KB |
Guessed the password with 581 queries. |
7 |
Correct |
210 ms |
336 KB |
Guessed the password with 19205 queries. |
8 |
Correct |
327 ms |
336 KB |
Guessed the password with 34674 queries. |
9 |
Correct |
407 ms |
464 KB |
Guessed the password with 43495 queries. |
10 |
Incorrect |
405 ms |
464 KB |
Could not guess the password with 50000 queries. |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
336 KB |
Guessed the password with 226 queries. |
2 |
Correct |
5 ms |
336 KB |
Guessed the password with 530 queries. |
3 |
Correct |
1 ms |
208 KB |
Guessed the password with 95 queries. |
4 |
Correct |
5 ms |
208 KB |
Guessed the password with 262 queries. |
5 |
Correct |
3 ms |
208 KB |
Guessed the password with 336 queries. |
6 |
Correct |
6 ms |
208 KB |
Guessed the password with 581 queries. |
7 |
Correct |
210 ms |
336 KB |
Guessed the password with 19205 queries. |
8 |
Correct |
327 ms |
336 KB |
Guessed the password with 34674 queries. |
9 |
Correct |
407 ms |
464 KB |
Guessed the password with 43495 queries. |
10 |
Incorrect |
405 ms |
464 KB |
Could not guess the password with 50000 queries. |
11 |
Halted |
0 ms |
0 KB |
- |