#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(!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 |
23 ms |
19036 KB |
Output is correct |
2 |
Correct |
22 ms |
17872 KB |
Output is correct |
3 |
Correct |
52 ms |
20656 KB |
Output is correct |
4 |
Correct |
97 ms |
23540 KB |
Output is correct |
5 |
Incorrect |
87 ms |
25716 KB |
Output isn't correct |
6 |
Incorrect |
132 ms |
29520 KB |
Output isn't correct |
7 |
Correct |
81 ms |
25280 KB |
Output is correct |
8 |
Correct |
77 ms |
25424 KB |
Output is correct |
9 |
Correct |
162 ms |
27984 KB |
Output is correct |
10 |
Correct |
123 ms |
27964 KB |
Output is correct |