QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#522206 | #9167. Coprime Array | qwqwf# | WA | 0ms | 3748kb | C++14 | 1.2kb | 2024-08-16 19:38:08 | 2024-08-16 19:38:08 |
Judging History
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