#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
int is[30];
string lst[10000];
int query(string str);
string guess(int n, int s){
string ans = "";
int mx = 0, c = -1;
for (int i = 0; i < s; ++i){
string lol = "";
char ch = 'a';
ch += i;
for (int j = 1; j <= n; ++j){
lol += ch;
}
int kek = query(lol);
if (kek > mx){
mx = kek;
c = i;
}
is[i] = kek;
}
for (int j = 1; j <= mx; ++j){
char ch = 'a';
ch += c;
ans += ch;
}
is[c] = 0;
for (int i = 0; i < s; ++i){
if (is[i] == 0){
continue;
}
while (is[i] > 0){
char ch = 'a';
ch += i;
int len = (int)ans.size();
int len2 = len;
string nans = "", pref = "";
for (int j = 0; j <= len; ++j){
string suff = "";
for (int k = j; k < len; ++k){
suff += ans[k];
}
while (is[i] > 0){
string q = nans;
q += ch;
q += suff;
if ((int)q.size() > n)
break;
int kek = query(q);
if (kek == len2 + 1){
nans += ch;
is[i] -= 1;
len2 += 1;
}
else{
break;
}
}
if (j < len){
nans += ans[j];
pref += ans[j];
}
}
ans = nans;
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
592 KB |
Guessed the password with 76 queries. |
2 |
Runtime error |
3 ms |
612 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
592 KB |
Guessed the password with 52 queries. |
2 |
Correct |
1 ms |
592 KB |
Guessed the password with 116 queries. |
3 |
Correct |
2 ms |
620 KB |
Guessed the password with 181 queries. |
4 |
Correct |
2 ms |
612 KB |
Guessed the password with 216 queries. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
58 ms |
616 KB |
Guessed the password with 4788 queries. |
2 |
Correct |
102 ms |
768 KB |
Guessed the password with 10281 queries. |
3 |
Correct |
198 ms |
652 KB |
Guessed the password with 13667 queries. |
4 |
Correct |
270 ms |
780 KB |
Guessed the password with 20689 queries. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
592 KB |
Guessed the password with 76 queries. |
2 |
Runtime error |
3 ms |
612 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
592 KB |
Guessed the password with 76 queries. |
2 |
Runtime error |
3 ms |
612 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |