#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mid (start+end)/2
#define OYY 1000005
#define ordu ios_base::sync_with_stdio(false);cin.tie(NULL);
map <int,int> mp;
int as[OYY];
int32_t main(){
ordu
int t=1;//cin>>t;
while(t--){
mp.clear();
int n,k;cin>>n>>k;
int dizi[n];
for(int i=0;i<n;i++){
cin>>dizi[i];
mp[dizi[i]]++;
}
map <int,int> ::iterator it=mp.begin();
while(it!=mp.end()){
if(it->first<=k){
it++;
continue;
}
for(int j=k;j<OYY;j+=it->first){
as[j]+=it->second;
}
if(k==0)as[it->first]--;
//cout<<"Lost in japan"<<endl;;
it++;
}
for(int i=0;i<n;i++){
cout<<as[dizi[i]]<<" ";
}
cout<<'\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
8276 KB |
Output is correct |
2 |
Correct |
21 ms |
8148 KB |
Output is correct |
3 |
Correct |
51 ms |
9884 KB |
Output is correct |
4 |
Correct |
88 ms |
13256 KB |
Output is correct |
5 |
Correct |
125 ms |
16052 KB |
Output is correct |
6 |
Correct |
207 ms |
19136 KB |
Output is correct |
7 |
Correct |
117 ms |
15992 KB |
Output is correct |
8 |
Correct |
111 ms |
15956 KB |
Output is correct |
9 |
Correct |
209 ms |
18768 KB |
Output is correct |
10 |
Correct |
185 ms |
18712 KB |
Output is correct |