#include<bits/stdc++.h>
using namespace std;
vector<int>divisors[1000001];
int mp[1000001];
int main(){
for(int i=1; i<=1000000; i++){
for(int j=i; j<=1000000; j+=i){
divisors[j].push_back(i);
}
}
int n, k;
cin >> n >> k;
vector< pair<int, int> >v(n);
for(int i=0; i<n; i++){
cin >> v[i].first;
v[i].second = i;
mp[v[i].first]++;
}
sort(v.begin(), v.end());
vector<int>d(n);
for(int i=0; i<n; i++){
//cout << v[i] << '\n';
int val = v[i].first - k;
if(val <= 0){
if(k == v[i].first){
d[v[i].second] = n-i-1;
}else {
d[v[i].second] = 0;
}
}
else {
int ans = 0;
for(int e:divisors[val]){
if(e==k)continue;
ans += mp[e];
}
d[v[i].second] = ans;
}
}
for(int e:d)cout << e << " ";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1763 ms |
117108 KB |
Output isn't correct |
2 |
Incorrect |
1690 ms |
116312 KB |
Output isn't correct |
3 |
Incorrect |
1849 ms |
118656 KB |
Output isn't correct |
4 |
Incorrect |
1968 ms |
121704 KB |
Output isn't correct |
5 |
Incorrect |
1804 ms |
120168 KB |
Output isn't correct |
6 |
Incorrect |
1945 ms |
123080 KB |
Output isn't correct |
7 |
Incorrect |
1822 ms |
120068 KB |
Output isn't correct |
8 |
Incorrect |
1785 ms |
120088 KB |
Output isn't correct |
9 |
Incorrect |
1964 ms |
123012 KB |
Output isn't correct |
10 |
Incorrect |
1970 ms |
123028 KB |
Output isn't correct |