QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#514264 | #9167. Coprime Array | ucup-team3695# | WA | 12ms | 10828kb | Python3 | 428b | 2024-08-10 23:51:02 | 2024-08-10 23:51:02 |
Judging History
answer
from math import gcd
import sys
input=lambda:sys.stdin.readline().strip()
a,b=map(int,input().split())
c=a%b
def fin(l):
t=sum(l)
assert(t%b==c)
l[0]+=a-t
print(len(l))
print(*l)
if c==0:
print(-1)
exit()
if gcd(c,b)==1:
print(a)
exit()
for o in range(gcd(c,b)):
if o>0 and gcd(b,o)!=1:continue
g=(a-o-1)%b
if gcd(g,b)==1:
if o==0:fin([1,g])
else:fin([1,o,g])
exit()
print(-1)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 12ms
memory: 10760kb
input:
9 6
output:
3 7 1 1
result:
ok Correct
Test #2:
score: 0
Accepted
time: 3ms
memory: 10828kb
input:
14 34
output:
2 1 13
result:
ok Correct
Test #3:
score: -100
Wrong Answer
time: 3ms
memory: 10732kb
input:
1000000000 223092870
output:
-1
result:
wrong answer Jury has answer but participant doesn't