QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#87886 | #5103. Fair Division | zoker | WA | 8ms | 8104kb | Python3 | 458b | 2023-03-14 18:10:11 | 2023-03-14 18:10:12 |
Judging History
answer
import math
def ok(n, m, p, q):
if (n > 60):
return False
return m % ((p ** n - q ** n) // (p - q)) == 0
n, m = map(int, input().split())
N = 3000
if n > 60:
print("impossible")
exit(0)
temp = []
for i in range(0, N):
temp.append(i ** n)
for q in range(2, N):
for p in range(q - 1, 0, -1):
t = (temp[q] - temp[p]) // (q - p)
if (t > m):
break
if(m % t == 0):
print(q - p, q)
exit(0)
print("impossible")
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 8ms
memory: 8104kb
input:
13 382475111752106101
output:
impossible
result:
wrong answer 1st lines differ - expected: '17 28', found: 'impossible'