#include <bits/stdc++.h>
//#define int long long
#define ll unsigned long long
#define pb push_back
#define p_q priority_queue
#define m_p make_pair
#define pii pair<int,int>
#define endl '\n'
#define INIT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define forn(i, n) for (int i = 0; i < n; i++)
#define forn1(i, n) for (int i = 1; i <= n; i++)
#define all(x) x.begin(),x.end()
#define ft first
#define sd second
using namespace std;
const int N = 1e5+5;
const int INF = 1e18;
const int MOD = 1e9+7;
using namespace std;
int tot[26];
int ans[5000];
bool vis[26][26];
int query(string str);
string guess(int n, int s) {
forn(i,s) {
string S (n,char('a'+i));
tot[i] = query(S);
}
forn(i,s) {
for(int j = tot[i]; j >= 1; j--) {
int ret = 0;
forn(k,s) {
if(tot[k]==0) continue;
int t;
if(vis[i][k]) {
t = tot[k];
} else if(k==i) {
t = tot[i]-j;
} else {
string S (j,'a'+i);
string S2 (n-j,'a'+k);
t = query(S+S2)-j;
if(t==tot[k]) {
vis[i][k]=1;
}
}
ret += t;
}
ans[ret] = i;
}
}
string S;
for(int i = n-1; i >= 0; i--) {
S = S + (char)(ans[i]+'a');
}
return S;
}
Compilation message
password.cpp:19:17: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
19 | const int INF = 1e18;
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
208 KB |
Guessed the password with 226 queries. |
2 |
Correct |
5 ms |
208 KB |
Guessed the password with 530 queries. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Guessed the password with 49 queries. |
2 |
Correct |
2 ms |
208 KB |
Guessed the password with 140 queries. |
3 |
Correct |
1 ms |
208 KB |
Guessed the password with 21 queries. |
4 |
Correct |
4 ms |
208 KB |
Guessed the password with 301 queries. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
78 ms |
308 KB |
Guessed the password with 9374 queries. |
2 |
Correct |
179 ms |
288 KB |
Guessed the password with 17840 queries. |
3 |
Correct |
243 ms |
312 KB |
Guessed the password with 20842 queries. |
4 |
Correct |
375 ms |
308 KB |
Guessed the password with 37302 queries. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
208 KB |
Guessed the password with 226 queries. |
2 |
Correct |
5 ms |
208 KB |
Guessed the password with 530 queries. |
3 |
Correct |
1 ms |
208 KB |
Guessed the password with 49 queries. |
4 |
Correct |
2 ms |
208 KB |
Guessed the password with 140 queries. |
5 |
Correct |
1 ms |
208 KB |
Guessed the password with 21 queries. |
6 |
Correct |
4 ms |
208 KB |
Guessed the password with 301 queries. |
7 |
Correct |
78 ms |
308 KB |
Guessed the password with 9374 queries. |
8 |
Correct |
179 ms |
288 KB |
Guessed the password with 17840 queries. |
9 |
Correct |
243 ms |
312 KB |
Guessed the password with 20842 queries. |
10 |
Correct |
375 ms |
308 KB |
Guessed the password with 37302 queries. |
11 |
Correct |
280 ms |
444 KB |
Guessed the password with 41380 queries. |
12 |
Incorrect |
351 ms |
448 KB |
Could not guess the password with 50000 queries. |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
208 KB |
Guessed the password with 226 queries. |
2 |
Correct |
5 ms |
208 KB |
Guessed the password with 530 queries. |
3 |
Correct |
1 ms |
208 KB |
Guessed the password with 49 queries. |
4 |
Correct |
2 ms |
208 KB |
Guessed the password with 140 queries. |
5 |
Correct |
1 ms |
208 KB |
Guessed the password with 21 queries. |
6 |
Correct |
4 ms |
208 KB |
Guessed the password with 301 queries. |
7 |
Correct |
78 ms |
308 KB |
Guessed the password with 9374 queries. |
8 |
Correct |
179 ms |
288 KB |
Guessed the password with 17840 queries. |
9 |
Correct |
243 ms |
312 KB |
Guessed the password with 20842 queries. |
10 |
Correct |
375 ms |
308 KB |
Guessed the password with 37302 queries. |
11 |
Correct |
280 ms |
444 KB |
Guessed the password with 41380 queries. |
12 |
Incorrect |
351 ms |
448 KB |
Could not guess the password with 50000 queries. |
13 |
Halted |
0 ms |
0 KB |
- |