QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#514264#9167. Coprime Arrayucup-team3695#WA 12ms10828kbPython3428b2024-08-10 23:51:022024-08-10 23:51:02

Judging History

你现在查看的是最新测评结果

  • [2024-08-11 17:38:28]
  • hack成功,自动添加数据
  • (/hack/775)
  • [2024-08-10 23:51:02]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:10828kb
  • [2024-08-10 23:51:02]
  • 提交

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)

詳細信息

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