/// Zengy MANGA
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
#define f(i, a, b) for(int i = a; i < b; i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define mp(x,y) make_pair(x,y)
#define popCnt(x) (__builtin_popcountll(x))
using ll = long long;
using ii = pair<int,int>;
using ull = unsigned long long;
using db = long double;
const int N = 2e5+5, LG = 18, MOD = 998244353;
const long double PI = acos(-1);
int query(string s);
string guess(int n, int s) {
string ans = "";
for(char c = 'a'; c < 'a'+s; c++) {
for(int j = 0; ans.size() != n && j <= ans.size(); j++) {
if(query(ans.substr(0,j)+string(1,c)+ans.substr(j)) > ans.size()) {
ans = ans.substr(0,j)+string(1,c)+ans.substr(j);
}
}
}
return ans;
}
Compilation message
password.cpp: In function 'std::string guess(int, int)':
password.cpp:33:35: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
33 | for(int j = 0; ans.size() != n && j <= ans.size(); j++) {
| ~~~~~~~~~~~^~~~
password.cpp:33:45: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | for(int j = 0; ans.size() != n && j <= ans.size(); j++) {
| ~~^~~~~~~~~~~~~
password.cpp:34:65: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
34 | if(query(ans.substr(0,j)+string(1,c)+ans.substr(j)) > ans.size()) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Guessed the password with 133 queries. |
2 |
Correct |
3 ms |
200 KB |
Guessed the password with 294 queries. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Guessed the password with 71 queries. |
2 |
Correct |
2 ms |
280 KB |
Guessed the password with 166 queries. |
3 |
Runtime error |
1 ms |
288 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
52 ms |
340 KB |
Guessed the password with 4807 queries. |
2 |
Correct |
79 ms |
328 KB |
Guessed the password with 10754 queries. |
3 |
Correct |
131 ms |
348 KB |
Guessed the password with 14365 queries. |
4 |
Correct |
177 ms |
472 KB |
Guessed the password with 20878 queries. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Guessed the password with 133 queries. |
2 |
Correct |
3 ms |
200 KB |
Guessed the password with 294 queries. |
3 |
Correct |
2 ms |
200 KB |
Guessed the password with 71 queries. |
4 |
Correct |
2 ms |
280 KB |
Guessed the password with 166 queries. |
5 |
Runtime error |
1 ms |
288 KB |
Execution killed with signal 13 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Guessed the password with 133 queries. |
2 |
Correct |
3 ms |
200 KB |
Guessed the password with 294 queries. |
3 |
Correct |
2 ms |
200 KB |
Guessed the password with 71 queries. |
4 |
Correct |
2 ms |
280 KB |
Guessed the password with 166 queries. |
5 |
Runtime error |
1 ms |
288 KB |
Execution killed with signal 13 |
6 |
Halted |
0 ms |
0 KB |
- |