제출 #1159674

#제출 시각아이디문제언어결과실행 시간메모리
1159674fryingducPassword (RMI18_password)C++20
20 / 100
27 ms468 KiB
#include "bits/stdc++.h" using namespace std; #ifdef duc_debug #include "bits/debug.h" #else #define debug(...) #endif extern int query(string s); string calc(int l, int r, int len) { if (l == r) { string cur; for (int i = 0; i < len; ++i) { cur += char('a' + l); } int x = query(cur); cur.clear(); for (int i = 0; i < x; ++i) { cur += char('a' + l); } return cur; } int mid = (l + r) >> 1; string x = calc(l, mid, len); string y = calc(mid + 1, r, len); string res; int px = 0, py = 0; while (px < (int)x.size() and py < (int)y.size()) { string g = res + x[px]; for (int i = py; i < (int)y.size(); ++i) { g += y[i]; } int cur_g = query(g); if (cur_g > (int)res.size() + (int)y.size() - py) { res += x[px++]; } else { res += y[py++]; } } while (px < (int)x.size()) { res += x[px++]; } while (py < (int)y.size()) { res += y[py++]; } return res; } string guess(int _N, int _C) { return calc(0, _C - 1, _N); }
#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...