Submission #19450926


Source Code Expand

Copy
n, p = (int(_) for _ in input().split())
l = []
ans = 1
while p%2 == 0:
    l += [2]
    p //= 2
f = 3
while f*f <= p:
    if p%f == 0:
        l += [f]
        p //= f
    else:
        f += 2
if p != 1:
    l += [p]
s = set(l)
for i in s:
    ans *= i**(l.count(i)//n)
print(ans)

Submission Info

Submission Time
Task C - Product and GCD
User bgwrm
Language Python (3.8.2)
Score 300
Code Size 299 Byte
Status AC
Exec Time 67 ms
Memory 9112 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 34
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt, sample4.txt
All sample1.txt, sample2.txt, sample3.txt, sample4.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt, sample4.txt
Case Name Status Exec Time Memory
1.txt AC 35 ms 9004 KB
10.txt AC 20 ms 8948 KB
11.txt AC 19 ms 9104 KB
12.txt AC 18 ms 8992 KB
13.txt AC 28 ms 9068 KB
14.txt AC 25 ms 8964 KB
15.txt AC 19 ms 8860 KB
16.txt AC 21 ms 8856 KB
17.txt AC 38 ms 9112 KB
18.txt AC 23 ms 8852 KB
19.txt AC 18 ms 8856 KB
2.txt AC 36 ms 9000 KB
20.txt AC 23 ms 9064 KB
21.txt AC 26 ms 9020 KB
22.txt AC 23 ms 8960 KB
23.txt AC 67 ms 8856 KB
24.txt AC 19 ms 8964 KB
25.txt AC 18 ms 8860 KB
26.txt AC 19 ms 8856 KB
3.txt AC 19 ms 9076 KB
4.txt AC 27 ms 8956 KB
5.txt AC 19 ms 8936 KB
6.txt AC 28 ms 8996 KB
7.txt AC 34 ms 8996 KB
8.txt AC 35 ms 8996 KB
9.txt AC 19 ms 9000 KB
sample1.txt AC 19 ms 9024 KB
sample2.txt AC 22 ms 8964 KB
sample3.txt AC 28 ms 8852 KB
sample4.txt AC 18 ms 8860 KB