QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#516093#9167. Coprime Arraynahida_qaqWA 0ms3704kbC++17643b2024-08-12 13:40:162024-08-12 13:40:16

Judging History

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

  • [2024-08-12 13:40:16]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3704kb
  • [2024-08-12 13:40:16]
  • 提交

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;
}

详细

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