QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#725716#9167. Coprime ArraymaxiaomengWA 10ms3744kbC++141.1kb2024-11-08 19:34:342024-11-08 19:34:35

Judging History

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

  • [2024-11-08 19:34:35]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:3744kb
  • [2024-11-08 19:34:34]
  • 提交

answer

#include<iostream>
#include<time.h>
#include<cstdlib>
#define int long long
using namespace std;
const int mod=99824435,inf=1e8;
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int ca(int a,int b){
    return gcd(abs(a),abs(b));
}
signed main(){
    srand(time(0));
    int s,xe;
    cin>>s>>xe;
    if(ca(s,xe)==1){
        cout<<"1\n"<<s<<"\n";
        return 0;
    }
    for(int i=1;i<=100000;i++){
        int x=rand()+rand()+rand()-rand()-rand();
        x%=mod;
        int y=s-x;
        if(abs(x)>inf || abs(y)>inf)continue;
        if(ca(x,xe)!=1 || ca(y,xe)!=1)continue;
        cout<<2<<"\n"<<x<<" "<<y<<"\n";
        return 0;
    }
    for(int i=1;i<=100000;i++){
        int x=rand()+rand()+rand()-rand()-rand();
        int y=rand()-rand()+rand()-rand()+rand();
        x%=mod,y%=mod;
        int z=s-x-y;
        if(abs(x)>inf || abs(y)>inf || abs(z)>inf)continue;
        if(ca(x,xe)!=1 || ca(y,xe)!=1 || ca(z,xe)!=1)continue;
        cout<<3<<"\n"<<x<<" "<<y<<" "<<z<<"\n";
        return 0;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 5ms
memory: 3744kb

input:

9 6

output:

3
15482003 52726919 -68208913

result:

ok Correct

Test #2:

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

input:

14 34

output:

2
-18267337 18267351

result:

ok Correct

Test #3:

score: -100
Wrong Answer
time: 10ms
memory: 3600kb

input:

1000000000 223092870

output:


result:

wrong output format Unexpected end of file - int32 expected