#include <iostream>
using namespace std;
#define int long long
int n, k, city[300005], cnt[1000005], divisors[1000005];
signed main() {
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> city[i];
cnt[city[i]] += 1;
}
for (int i = k + 1; i < 1000005; i++) {
for (int j = 0; j < 1000005; j += i) {
divisors[j] += cnt[i];
}
}
for (int i = 0; i < n; i++) {
cout << (city[i] >= k ? divisors[city[i] - k] : 0) << ' ';
}
cout << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
11088 KB |
Output is correct |
2 |
Correct |
60 ms |
9864 KB |
Output is correct |
3 |
Correct |
107 ms |
12380 KB |
Output is correct |
4 |
Correct |
182 ms |
14384 KB |
Output is correct |
5 |
Incorrect |
121 ms |
16964 KB |
Output isn't correct |
6 |
Incorrect |
214 ms |
19120 KB |
Output isn't correct |
7 |
Correct |
112 ms |
16852 KB |
Output is correct |
8 |
Correct |
115 ms |
16912 KB |
Output is correct |
9 |
Correct |
214 ms |
18988 KB |
Output is correct |
10 |
Correct |
220 ms |
18932 KB |
Output is correct |