QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#725719#9167. Coprime ArraymaxiaomengWA 93ms3760kbC++141.1kb2024-11-08 19:35:172024-11-08 19:35:17

Judging History

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

  • [2024-11-08 19:35:17]
  • 评测
  • 测评结果:WA
  • 用时:93ms
  • 内存:3760kb
  • [2024-11-08 19:35:17]
  • 提交

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<=1000000;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<=1000000;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: 48ms
memory: 3760kb

input:

9 6

output:

3
-1395673 47048297 -45652615

result:

ok Correct

Test #2:

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

input:

14 34

output:

2
22730627 -22730613

result:

ok Correct

Test #3:

score: -100
Wrong Answer
time: 93ms
memory: 3616kb

input:

1000000000 223092870

output:


result:

wrong output format Unexpected end of file - int32 expected