QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#522206#9167. Coprime Arrayqwqwf#WA 0ms3748kbC++141.2kb2024-08-16 19:38:082024-08-16 19:38:08

Judging History

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

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

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<<2<<'\n';
		cout<<1<<' ';
		cout<<p-1<<'\n';
		return 0;
	}
	int i,j;
	for(i=s,j=s;i!=x&&j!=0;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==x){
		cout<<abs(s-i)<<'\n';
		cout<<-1+x+p<<' ';
		for(int k=1;k<abs(s-i);k++) cout<<-1<<' ';cout<<'\n';
		return 0;
	}
	if(j==0){
		cout<<abs(s-j)<<'\n';
		cout<<1+p<<' ';
		for(int k=1;k<abs(s-j);k++) cout<<1<<' ';cout<<'\n';
		return 0;
	}
	return 0;
}

詳細信息

Test #1:

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

input:

9 6

output:

3
11 -1 -1 

result:

ok Correct

Test #2:

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

input:

14 34

output:

2
15 -1 

result:

ok Correct

Test #3:

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

input:

1000000000 223092870

output:

4
999999997 1 1 1 

result:

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