This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |