QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#511713 | #9167. Coprime Array | ucup-team4508# | WA | 0ms | 3812kb | C++14 | 498b | 2024-08-10 10:17:41 | 2024-08-10 10:17:42 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define LL long long
LL n,i,j,k,m;
LL a[500005];
LL gcd(LL x,LL y){
if(y==0) return x;
else return gcd(y,x%y);
}
int main(){
scanf("%lld%lld",&n,&m);
if(n<=1000000){
printf("%lld\n",n);
for(i=1;i<=n;i++)
printf("1 ");
return 0;
}
for(i=1;i<=1000000;i++){
LL x=gcd(n-i+1,m);
if(x==1){
printf("%lld\n",i);
for(j=1;j<i;j++)
printf("1 ");
printf("%lld",n-i+1);
return 0;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3812kb
input:
9 6
output:
9 1 1 1 1 1 1 1 1 1
result:
wrong answer Jury's answer is better than participant's