QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#512326#9167. Coprime Arrayucup-team3661#AC ✓70ms3688kbC++20759b2024-08-10 14:09:142024-08-10 14:09:14

Judging History

你现在查看的是测评时间为 2024-08-10 14:09:14 的历史记录

  • [2024-10-14 07:51:58]
  • 管理员手动重测本题所有获得100分的提交记录
  • 测评结果:AC
  • 用时:69ms
  • 内存:3716kb
  • [2024-08-11 17:38:28]
  • hack成功,自动添加数据
  • (/hack/775)
  • [2024-08-10 14:09:14]
  • 评测
  • 测评结果:100
  • 用时:70ms
  • 内存:3688kb
  • [2024-08-10 14:09:14]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

int main(){
	int s, x;
	cin >> s >> x;
	if(gcd(s, x) == 1){
		cout << 1 << endl;
		cout << s << endl;
		return 0;
	}
	if(s % 2 == 1 && x % 2 == 0){
		cout << 3 << endl;
		for(int i = -(1<<20); i <= (1<<20); ++i){
			if(gcd(abs(i), abs(x)) != 1) continue;
			if(s-i-i > 1000000000) continue;
			if(gcd(abs(s-i-i), abs(x)) == 1){
				cout << i << ' ' << i << ' ' << s-i-i << endl;
				return 0;
			}
		}
	}else{
		cout << 2 << endl;
		for(int i = -(1<<20); i <= (1<<20); ++i){
			if(gcd(abs(i), abs(x)) != 1) continue;
			if(s-i > 1000000000) continue;
			if(gcd(abs(s-i), abs(x)) == 1){
				cout << i << ' ' << s-i << endl;
				return 0;
			}
		}
	}
	assert(false);
	return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3688kb

input:

9 6

output:

3
-1048573 -1048573 2097155

result:

ok Correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

14 34

output:

2
-1048575 1048589

result:

ok Correct

Test #3:

score: 0
Accepted
time: 70ms
memory: 3676kb

input:

1000000000 223092870

output:

2
29 999999971

result:

ok Correct

Test #4:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

2 1000000000

output:

2
-1048571 1048573

result:

ok Correct

Test #5:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

649557664 933437700

output:

2
-1048573 650606237

result:

ok Correct

Test #6:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

33396678 777360870

output:

2
-1048573 34445251

result:

ok Correct

Test #7:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

48205845 903124530

output:

3
-1048573 -1048573 50302991

result:

ok Correct

Test #8:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

251037078 505905400

output:

2
-1048573 252085651

result:

ok Correct

Test #9:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

30022920 172746860

output:

2
-1048573 31071493

result:

ok Correct

Test #10:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

63639298 808058790

output:

2
-1048573 64687871

result:

ok Correct

Test #11:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

76579017 362768406

output:

3
-1048573 -1048573 78676163

result:

ok Correct

Test #12:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

40423669 121437778

output:

3
-1048573 -1048573 42520815

result:

ok Correct

Test #13:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

449277309 720915195

output:

2
-1048573 450325882

result:

ok Correct

Test #14:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

81665969 919836918

output:

3
-1048573 -1048573 83763115

result:

ok Correct

Test #15:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

470578680 280387800

output:

2
-1048573 471627253

result:

ok Correct

Test #16:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

58450340 803305503

output:

2
-1048574 59498914

result:

ok Correct

Test #17:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

125896113 323676210

output:

3
-1048573 -1048573 127993259

result:

ok Correct

Test #18:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

381905348 434752500

output:

2
-1048571 382953919

result:

ok Correct

Test #19:

score: 0
Accepted
time: 0ms
memory: 3688kb

input:

78916498 653897673

output:

1
78916498

result:

ok Correct

Test #20:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

35787885 270845190

output:

3
-1048567 -1048567 37885019

result:

ok Correct

Extra Test:

score: 0
Extra Test Passed