QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#511971#9167. Coprime Arrayucup-team1004#AC ✓0ms3812kbC++14777b2024-08-10 13:08:572024-08-10 13:08:58

Judging History

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

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

answer

#include<bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include"debug.h"
#else
#define debug(...) void()
#endif
#define all(x) (x).begin(),(x).end()
template<class T>
auto ary(T *a,int l,int r){
	return vector<T>{a+l,a+1+r};
}
using ll=long long;
using ull=unsigned long long;
int s,x;
int main(){
	cin>>s>>x;
	if(__gcd(s,x)==1)cout<<1<<endl<<s<<endl,exit(0);
	mt19937 rnd(time(0));
	int V=1e8;
	if(s%2==1&&x%2==0){
		int a,b,c;
		do a=2*(rnd()%V)+1,b=2*(rnd()%V)+1,c=s-a-b;while(__gcd(a,x)>1||__gcd(b,x)>1||__gcd(abs(c),x)>1);
		cout<<3<<endl<<a<<' '<<b<<' '<<c<<endl;
		exit(0);
	}
	int a,b;
	do a=rnd()%V+1,b=s-a;while(__gcd(a,x)>1||__gcd(abs(b),x)>1);
	cout<<2<<endl<<a<<' '<<b<<endl;
	return 0;
}
#ifdef DEBUG
#include"debug.hpp"
#endif

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

9 6

output:

3
27416959 188202889 -215619839

result:

ok Correct

Test #2:

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

input:

14 34

output:

2
69460355 -69460341

result:

ok Correct

Test #3:

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

input:

1000000000 223092870

output:

2
85384787 914615213

result:

ok Correct

Test #4:

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

input:

2 1000000000

output:

2
78775009 -78775007

result:

ok Correct

Test #5:

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

input:

649557664 933437700

output:

2
85384787 564172877

result:

ok Correct

Test #6:

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

input:

33396678 777360870

output:

2
78775009 -45378331

result:

ok Correct

Test #7:

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

input:

48205845 903124530

output:

3
141975233 156565931 -250335319

result:

ok Correct

Test #8:

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

input:

251037078 505905400

output:

2
79301251 171735827

result:

ok Correct

Test #9:

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

input:

30022920 172746860

output:

2
78775009 -48752089

result:

ok Correct

Test #10:

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

input:

63639298 808058790

output:

2
85384787 -21745489

result:

ok Correct

Test #11:

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

input:

76579017 362768406

output:

3
192846539 90967229 -207234751

result:

ok Correct

Test #12:

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

input:

40423669 121437778

output:

3
64188709 144822809 -168587849

result:

ok Correct

Test #13:

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

input:

449277309 720915195

output:

2
10776076 438501233

result:

ok Correct

Test #14:

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

input:

81665969 919836918

output:

3
157550017 17742479 -93626527

result:

ok Correct

Test #15:

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

input:

470578680 280387800

output:

2
79301251 391277429

result:

ok Correct

Test #16:

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

input:

58450340 803305503

output:

2
13708480 44741860

result:

ok Correct

Test #17:

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

input:

125896113 323676210

output:

3
34465523 168909539 -77478949

result:

ok Correct

Test #18:

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

input:

381905348 434752500

output:

2
78775009 303130339

result:

ok Correct

Test #19:

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

input:

78916498 653897673

output:

1
78916498

result:

ok Correct

Test #20:

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

input:

35787885 270845190

output:

3
34465523 168909539 -167587177

result:

ok Correct

Extra Test:

score: 0
Extra Test Passed