QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#114063 | #6566. Power of Divisors | UFRJ# | WA | 151ms | 4060kb | C++20 | 716b | 2023-06-20 20:27:13 | 2023-06-20 20:27:16 |
Judging History
answer
#include "bits/stdc++.h"
using lint = int64_t;
using namespace std;
map<lint,lint> memo;
int countDiv(lint x) {
set<lint> st;
for(int i = 1; i <= x; i++) {
if(x % i == 0) {
st.insert(i);
st.insert(x/i);
}
}
return st.size();
}
void pre() {
for(int i = 1; i < 10000; i++) {
int cnt = countDiv(i);
long double ans = pow(i, cnt);
if(ans < 1e18) {
memo[lint(ans)] = i;
}
}
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
pre();
lint n;
cin >> n;
if(memo.count(n)) {
cout << memo[n] << endl;
} else {
cout << -1 << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 151ms
memory: 4020kb
input:
15625
output:
25
result:
ok single line: '25'
Test #2:
score: 0
Accepted
time: 151ms
memory: 3924kb
input:
64000000
output:
20
result:
ok single line: '20'
Test #3:
score: 0
Accepted
time: 147ms
memory: 3956kb
input:
65536
output:
-1
result:
ok single line: '-1'
Test #4:
score: 0
Accepted
time: 151ms
memory: 4060kb
input:
1
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 147ms
memory: 4024kb
input:
10
output:
-1
result:
ok single line: '-1'
Test #6:
score: 0
Accepted
time: 151ms
memory: 4052kb
input:
100
output:
-1
result:
ok single line: '-1'
Test #7:
score: 0
Accepted
time: 151ms
memory: 3928kb
input:
10000
output:
10
result:
ok single line: '10'
Test #8:
score: -100
Wrong Answer
time: 151ms
memory: 4048kb
input:
1000000000000000000
output:
-1
result:
wrong answer 1st lines differ - expected: '100', found: '-1'