QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#514408#9167. Coprime Arrayucup-team3695#WA 0ms3700kbC++20839b2024-08-11 01:17:302024-08-11 01:17:31

Judging History

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

  • [2024-08-11 17:38:28]
  • hack成功,自动添加数据
  • (/hack/775)
  • [2024-08-11 01:17:31]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3700kb
  • [2024-08-11 01:17:30]
  • 提交

answer

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

#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
#define F first
#define S second
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);
	ll a,b;cin>>a>>b;
	ll c = a%b;
	if(c==0){
		cout<<-1<<endl;
		return 0;
	}
	bool theflag=false;
	if(b%2==0 && c%2==1){
		theflag=true;
		c-=1;
	}
	rep(i,1,b/2+1){
		if(__gcd(i,b)!=1)continue;
		ll otr = (10*b+c-i)%b;
		if(__gcd(otr,b)!=1) continue;
		if(theflag){
			ll t = 1+i+otr;
			otr+=a-t;
			cout<<3<<'\n'<<otr<<' '<<i<<' '<<1<<endl;
		}else{
			ll t = i+otr;
			otr+=a-t;
			cout<<2<<'\n'<<otr<<' '<<i<<endl;
		}
		break;
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

9 6

output:

3
7 1 1

result:

ok Correct

Test #2:

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

input:

14 34

output:

2
13 1

result:

ok Correct

Test #3:

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

input:

1000000000 223092870

output:

2
999999971 29

result:

ok Correct

Test #4:

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

input:

2 1000000000

output:

2
1 1

result:

ok Correct

Test #5:

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

input:

649557664 933437700

output:

2
649557653 11

result:

ok Correct

Test #6:

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

input:

33396678 777360870

output:

2
33396677 1

result:

ok Correct

Test #7:

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

input:

48205845 903124530

output:

3
48205813 31 1

result:

ok Correct

Test #8:

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

input:

251037078 505905400

output:

2
251037077 1

result:

ok Correct

Test #9:

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

input:

30022920 172746860

output:

2
30022919 1

result:

ok Correct

Test #10:

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

input:

63639298 808058790

output:

2
63639269 29

result:

ok Correct

Test #11:

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

input:

76579017 362768406

output:

3
76579015 1 1

result:

ok Correct

Test #12:

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

input:

40423669 121437778

output:

3
40423667 1 1

result:

ok Correct

Test #13:

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

input:

449277309 720915195

output:

2
449277308 1

result:

ok Correct

Test #14:

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

input:

81665969 919836918

output:

3
81665963 5 1

result:

ok Correct

Test #15:

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

input:

470578680 280387800

output:

2
470578679 1

result:

ok Correct

Test #16:

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

input:

58450340 803305503

output:

2
58450339 1

result:

ok Correct

Test #17:

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

input:

125896113 323676210

output:

3
125896081 31 1

result:

ok Correct

Test #18:

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

input:

381905348 434752500

output:

2
381905347 1

result:

ok Correct

Test #19:

score: -100
Wrong Answer
time: 0ms
memory: 3572kb

input:

78916498 653897673

output:

2
78916496 2

result:

wrong answer Jury's answer is better than participant's