Submission #709356

#TimeUsernameProblemLanguageResultExecution timeMemory
709356maomao90Password (RMI18_password)C++17
10 / 100
9 ms552 KiB
// 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]; string dnc(int l, int r) { if (l == r) { return string(occ[l], 'a' + l); } int m = l + r >> 1; string sl = dnc(l, m), sr = dnc(m + 1, r); string str = sl; int ptr = 0; REP (i, 0, SZ(sr)) { str.insert(ptr, 1, sr[i]); while (ptr <= SZ(sr) + i && query(str) != SZ(str)) { str.erase(ptr, 1); ptr++; str.insert(ptr, 1, sr[i]); } ptr++; } return str; } string guess(int n, int s) { REP (c, 0, s) { string str(n, 'a' + c); occ[c] = query(str); } string ans = dnc(0, s - 1); return ans; }

Compilation message (stderr)

password.cpp: In function 'std::string dnc(int, int)':
password.cpp:46:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   46 |     int m = l + r >> 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...