QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#150637 | #6566. Power of Divisors | rgnerdplayer | WA | 2ms | 3500kb | C++20 | 1.5kb | 2023-08-25 22:44:07 | 2023-08-25 22:44:08 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
auto solve = [&]() {
i64 n;
cin >> n;
i64 ans = n + 1;
for (int p = 2; p <= 60; p++) {
i64 low = 2, high = n;
while (low < high) {
i64 mid = low + high >> 1;
i64 x = 1;
for (int i = 0; i < p; i++) {
if (x > n / mid) {
x = n + 1;
} else {
x *= mid;
}
}
if (x >= n) {
high = mid;
} else {
low = mid + 1;
}
}
i64 x = 1;
for (int i = 0; i < p; i++) {
if (x > n / low) {
x = n + 1;
} else {
x *= low;
}
}
if (x != n) {
continue;
}
int divs = 0;
for (int i = 1; i * i <= low; i++) {
if (low % i == 0) {
divs++;
if (i * i != low) {
divs++;
}
}
}
if (divs == p) {
ans = min(ans, low);
}
}
cout << (ans == n + 1 ? -1 : ans) << '\n';
};
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3420kb
input:
15625
output:
25
result:
ok single line: '25'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3396kb
input:
64000000
output:
20
result:
ok single line: '20'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3500kb
input:
65536
output:
-1
result:
ok single line: '-1'
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3440kb
input:
1
output:
-1
result:
wrong answer 1st lines differ - expected: '1', found: '-1'