QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#522195#9167. Coprime Arrayqwqwf#WA 0ms3732kbC++141.1kb2024-08-16 19:30:162024-08-16 19:30:17

Judging History

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

  • [2024-08-16 19:30:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3732kb
  • [2024-08-16 19:30:16]
  • 提交

answer

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
//#pragma GCC optimize("Ofast","unroll-loops","inline")
#include<bits/stdc++.h>
#define ll long long
//#define int ll
#define pb push_back
#define pii pair<int,int>
#define MP make_pair
#define fi first
#define se second
using namespace std;
const int N=5e5+10,M=1e6+10,mod=998244353;
int s,x;
signed main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>s>>x;
	int p=s-s%x;
	s%=x;
	if(!s){
		cout<<1<<'\n';
		cout<<p<<'\n';
		return 0;
	}
	int i,j;
	for(i=s,j=s;i!=0&&j!=x;i++,j--){
		if(__gcd(i,x)==1){
			cout<<abs(s-i)+1<<'\n';
			cout<<i+p<<' ';
			for(int k=1;k<=abs(s-i);k++) cout<<-1<<' ';cout<<'\n';
			return 0;
		}
		if(__gcd(j,x)==1){
			cout<<abs(s-j)+1<<'\n';
			cout<<j+p<<' ';
			for(int k=1;k<=abs(s-j);k++) cout<<1<<' ';cout<<'\n';
			return 0;
		}
	}
	if(!i){
		cout<<abs(s-i)+1<<'\n';
		cout<<i+p<<' ';
		for(int k=1;k<=abs(s-i);k++) cout<<-1<<' ';cout<<'\n';
		return 0;
	}
	if(j==x){
		cout<<abs(s-j)+1<<'\n';
		cout<<j+p<<' ';
		for(int k=1;k<=abs(s-j);k++) cout<<1<<' ';cout<<'\n';
		return 0;
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

9 6

output:

3
11 -1 -1 

result:

ok Correct

Test #2:

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

input:

14 34

output:

2
15 -1 

result:

ok Correct

Test #3:

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

input:

1000000000 223092870

output:

4
999999997 1 1 1 

result:

wrong answer Jury's answer is better than participant's