#include <bits/stdc++.h>
using namespace std;
#define int long long
const int M = 1e6 + 1;
int cnt[M],ans[M];
signed main()
{
int n,k;
cin>>n>>k;
int a[n];
for (int i=0;i<n;i++)
{
cin>>a[i];
cnt[a[i]]++;
}
for (int i=k+1;i<M;i++)
for (int j=k;j<M;j+=i)
ans[j]+=cnt[i];
for (int i=0;i<n;i++)
cout<<ans[a[i]]<<' ';
cout<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
11096 KB |
Output is correct |
2 |
Correct |
23 ms |
9820 KB |
Output is correct |
3 |
Correct |
44 ms |
13032 KB |
Output is correct |
4 |
Correct |
89 ms |
16312 KB |
Output is correct |
5 |
Incorrect |
48 ms |
17480 KB |
Output isn't correct |
6 |
Incorrect |
96 ms |
21072 KB |
Output isn't correct |
7 |
Correct |
47 ms |
17500 KB |
Output is correct |
8 |
Correct |
47 ms |
17500 KB |
Output is correct |
9 |
Correct |
100 ms |
21072 KB |
Output is correct |
10 |
Correct |
95 ms |
21072 KB |
Output is correct |