#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define endl "\n"
#define int long long
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N = 1e6 + 5;
void solve()
{
int n,k;
cin >> n >> k;
int ar[n+1];
for(int i=1;i<=n;i++) cin >> ar[i];
vector<int> freq(N,0);
for(int i=1;i<=n;i++) freq[ar[i]]++;
vector<int> ans(N,0);
for(int i=k+1;i<N;i++)
for(int j=0;j<N;j+=i)
ans[j+k]+=freq[i];
for(int i=1;i<=n;i++)
{
cout << ans[ar[i]] << " \n"[i==n];
}
}
int32_t main(){
cin.tie(0); ios::sync_with_stdio(0);
int t=1;//cin >> t;
while(t--) solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
15960 KB |
Output is correct |
2 |
Correct |
19 ms |
15960 KB |
Output is correct |
3 |
Correct |
30 ms |
16988 KB |
Output is correct |
4 |
Correct |
54 ms |
19280 KB |
Output is correct |
5 |
Incorrect |
39 ms |
17080 KB |
Output isn't correct |
6 |
Incorrect |
56 ms |
19480 KB |
Output isn't correct |
7 |
Correct |
29 ms |
16984 KB |
Output is correct |
8 |
Correct |
29 ms |
16988 KB |
Output is correct |
9 |
Correct |
58 ms |
19176 KB |
Output is correct |
10 |
Correct |
56 ms |
19024 KB |
Output is correct |