#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=0;j<=2e6;j+=i){
ciur[j]+=frv[i];
}
}
}
for(i=1;i<=n;i++){
if(v[i]>=k) cout<<ciur[v[i]-k]<<" ";
else cout<<"0 ";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
19104 KB |
Output is correct |
2 |
Correct |
24 ms |
17756 KB |
Output is correct |
3 |
Correct |
47 ms |
20812 KB |
Output is correct |
4 |
Correct |
93 ms |
24008 KB |
Output is correct |
5 |
Incorrect |
85 ms |
25424 KB |
Output isn't correct |
6 |
Incorrect |
137 ms |
29012 KB |
Output isn't correct |
7 |
Correct |
64 ms |
25340 KB |
Output is correct |
8 |
Correct |
73 ms |
25332 KB |
Output is correct |
9 |
Correct |
133 ms |
28752 KB |
Output is correct |
10 |
Correct |
130 ms |
28752 KB |
Output is correct |