提交时间:2025-10-18 13:16:26
运行 ID: 38594
#include <functional> #pragma GCC optimize("Ofast,no-stack-protector") #include <algorithm> #include <cmath> #include <cstdio> using namespace std; using i64 = long long; constexpr int SQRT_EDGE = 54, MAX_EDGE = 3000; int main() { freopen("biggraph.in", "r", stdin); freopen("biggraph.out", "w", stdout); int q; scanf("%d", &q); int power[MAX_EDGE + 1]; for (int i = 1; i <= MAX_EDGE; ++i) power[i] = pow(i, 8.0 / 7); while (q-- > 0) { i64 x, y; scanf("%lld %lld", &x, &y); int ans = 1; function<void(i64, int, int)> dfs = [&](i64 cur, int len, int step) -> void { if (cur > y) return; else if (cur * MAX_EDGE >= y) { ans = max(ans, len * power[int(sqrt(double(y) / cur))]); return; } else if (step == 0) return; for (int i = 2; i <= SQRT_EDGE && cur * i * i <= y; ++i) dfs(cur * i * i, len * power[i], step - 1); }; dfs(x, 1, 2); printf("%d\n", ans); } return 0; }