#include <iostream>
using namespace std;
#define int long long
int v[2000001];
int ciur[2000001];
int frv[2000001];
signed main()
{
int n,i,j,k;
cin>>n>>k;
for(i=1;i<=n;i++){
cin>>v[i];
frv[v[i]]++;
}
for(i=1;i<=2e6;i++){
for(j=0;j<=2e6;j+=i){
if(k<i) ciur[j+k]+=frv[i];
}
}
for(i=1;i<=n;i++){
if(k==0)
cout<<ciur[v[i]]-1<<" ";
else
cout<<ciur[v[i]]<<" ";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
41 ms |
27268 KB |
Output isn't correct |
2 |
Incorrect |
43 ms |
27228 KB |
Output isn't correct |
3 |
Correct |
65 ms |
27560 KB |
Output is correct |
4 |
Incorrect |
111 ms |
30320 KB |
Output isn't correct |
5 |
Correct |
66 ms |
27528 KB |
Output is correct |
6 |
Correct |
116 ms |
30032 KB |
Output is correct |
7 |
Incorrect |
62 ms |
27476 KB |
Output isn't correct |
8 |
Incorrect |
72 ms |
27480 KB |
Output isn't correct |
9 |
Correct |
109 ms |
30032 KB |
Output is correct |
10 |
Incorrect |
111 ms |
30036 KB |
Output isn't correct |