QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#516093 | #9167. Coprime Array | nahida_qaq | WA | 0ms | 3704kb | C++17 | 643b | 2024-08-12 13:40:16 | 2024-08-12 13:40:16 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define io ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pb push_back
using namespace std;
const int N=1e6+5,mod1=1e9+7,mod2=998244353;
typedef pair<int,int> pi;
int a[N];
mt19937_64 rng(time(0));
void solve()
{
int s,x;
cin>>s>>x;
if(gcd(s,x)==1)
{
cout<<s;
return ;
}
else if(s%2==1&&x%2==0)
{
cout<<1<<' ';
s--;
}
while(1)
{
int a=rng()%100000000;
int b=s-a;
if(gcd(x,a)==1&&gcd(x,b)==1)
{
cout<<a<<' '<<b;
return ;
}
}
}
signed main()
{
io;
int t=1;
//cin>>t;
while(t--)
{
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3704kb
input:
9 6
output:
1 95224045 -95224037
result:
wrong answer Sum of the elements is not equal to s