#include <iostream>
using namespace std;
int n, k, city[300005], cnt[1000005], divisors[1000005];
int 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 |
30 ms |
6492 KB |
Output is correct |
2 |
Correct |
25 ms |
5656 KB |
Output is correct |
3 |
Correct |
74 ms |
7236 KB |
Output is correct |
4 |
Correct |
157 ms |
8676 KB |
Output is correct |
5 |
Incorrect |
83 ms |
8632 KB |
Output isn't correct |
6 |
Incorrect |
213 ms |
10096 KB |
Output isn't correct |
7 |
Correct |
72 ms |
8700 KB |
Output is correct |
8 |
Correct |
77 ms |
8696 KB |
Output is correct |
9 |
Correct |
174 ms |
10092 KB |
Output is correct |
10 |
Correct |
177 ms |
9980 KB |
Output is correct |