QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#511809#9167. Coprime Arrayucup-team4508#WA 0ms3708kbC++141.1kb2024-08-10 11:30:212024-08-10 11:30:21

Judging History

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

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

answer

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

using ui = unsigned;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,l,r) for(int i=(l);i>=(r);--i)
#define repn(i,n)  for(int i=0;i<(n);++i)
#define sizc(x) ((int)x.size())
#define allc(x) x.begin(),x.end()
#define fir first
#define sec second



signed main(){
    // freopen(".in","r",stdin);
    // freopen(".out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll s,x;cin>>s>>x;
    if(abs(__gcd(s,x))==1){
        cerr<<"1\n"<<s<<'\n';
        return 0;
    }
    if((s&1)&&!(x&1)){
        --s;
        for(ll i=1;i<=1e9;++i){
            ll j=s-i;
            if(__gcd(i,x)==1&&abs(__gcd(j,x))==1){
                cout<<"3\n1 "<<i<<' '<<j<<'\n';
                exit(0);
            }
        }
    }
    else{
        for(ll i=1;i<=1e9;++i){
            ll j=s-i;
            if(__gcd(i,x)==1&&abs(__gcd(j,x))==1){
                cout<<"2\n"<<i<<' '<<j<<'\n';
                exit(0);
            }
        }
    }
    cout<<"-1\n";
}

詳細信息

Test #1:

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

input:

9 6

output:

3
1 1 7

result:

ok Correct

Test #2:

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

input:

14 34

output:

2
1 13

result:

ok Correct

Test #3:

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

input:

1000000000 223092870

output:

2
29 999999971

result:

ok Correct

Test #4:

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

input:

2 1000000000

output:

2
1 1

result:

ok Correct

Test #5:

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

input:

649557664 933437700

output:

2
11 649557653

result:

ok Correct

Test #6:

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

input:

33396678 777360870

output:

2
1 33396677

result:

ok Correct

Test #7:

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

input:

48205845 903124530

output:

3
1 31 48205813

result:

ok Correct

Test #8:

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

input:

251037078 505905400

output:

2
1 251037077

result:

ok Correct

Test #9:

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

input:

30022920 172746860

output:

2
1 30022919

result:

ok Correct

Test #10:

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

input:

63639298 808058790

output:

2
29 63639269

result:

ok Correct

Test #11:

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

input:

76579017 362768406

output:

3
1 1 76579015

result:

ok Correct

Test #12:

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

input:

40423669 121437778

output:

3
1 1 40423667

result:

ok Correct

Test #13:

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

input:

449277309 720915195

output:

2
1 449277308

result:

ok Correct

Test #14:

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

input:

81665969 919836918

output:

3
1 5 81665963

result:

ok Correct

Test #15:

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

input:

470578680 280387800

output:

2
1 470578679

result:

ok Correct

Test #16:

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

input:

58450340 803305503

output:

2
1 58450339

result:

ok Correct

Test #17:

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

input:

125896113 323676210

output:

3
1 31 125896081

result:

ok Correct

Test #18:

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

input:

381905348 434752500

output:

2
1 381905347

result:

ok Correct

Test #19:

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

input:

78916498 653897673

output:


result:

wrong output format Unexpected end of file - int32 expected