#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,cnt=0;
cin>>n>>k;
for(i=1;i<=n;i++){
cin>>v[i];
if(v[i]>k){cnt++;
frv[v[i]]++;
}
}
for(i=1;i<=2e6;i++){
if(frv[i]){
for(j=i;j<=2e6;j+=i){
ciur[j]+=frv[i];
}
}
}
for(i=1;i<=n;i++){
if(v[i]==1 && !k) cout<<n-1<<" ";
else if(v[i]>k) cout<<ciur[v[i]-k]<<" ";
else if(v[i]==k) cout<<cnt<<" ";
else cout<<"0 ";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
18880 KB |
Output is correct |
2 |
Correct |
21 ms |
17756 KB |
Output is correct |
3 |
Correct |
46 ms |
21104 KB |
Output is correct |
4 |
Correct |
94 ms |
23892 KB |
Output is correct |
5 |
Incorrect |
75 ms |
25424 KB |
Output isn't correct |
6 |
Incorrect |
124 ms |
28888 KB |
Output isn't correct |
7 |
Correct |
60 ms |
25360 KB |
Output is correct |
8 |
Correct |
75 ms |
25364 KB |
Output is correct |
9 |
Correct |
125 ms |
28756 KB |
Output is correct |
10 |
Correct |
126 ms |
28624 KB |
Output is correct |