#include <iostream>
using namespace std;
#define int long long
int v[1000001];
int ciur[1000001];
int frv[1000001];
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<=1e6;i++){
if(frv[i]){
for(j=i;j<=1e6;j+=i){
ciur[j]+=frv[i];
}
}
}
for(i=1;i<=n;i++){
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 |
10 ms |
11100 KB |
Output is correct |
2 |
Correct |
11 ms |
10036 KB |
Output is correct |
3 |
Correct |
34 ms |
12880 KB |
Output is correct |
4 |
Correct |
84 ms |
16360 KB |
Output is correct |
5 |
Incorrect |
53 ms |
17500 KB |
Output isn't correct |
6 |
Incorrect |
104 ms |
21240 KB |
Output isn't correct |
7 |
Correct |
47 ms |
17492 KB |
Output is correct |
8 |
Correct |
48 ms |
17492 KB |
Output is correct |
9 |
Correct |
102 ms |
21116 KB |
Output is correct |
10 |
Correct |
94 ms |
21072 KB |
Output is correct |