#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int n, k, arr[N], cnt[N], ans[N];
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
cin >> n >> k;
for(int i = 1; i <= n; i++){
cin >> arr[i];
cnt[arr[i]]++;
}
for(int i = k + 1; i < N; i++){
for(int j = k; j < N; j += i){
ans[j] += cnt[i];
}
}
for(int i = 1; i <= n; i++) cout << ans[arr[i]] << " ";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
6484 KB |
Output is correct |
2 |
Correct |
16 ms |
5692 KB |
Output is correct |
3 |
Correct |
34 ms |
7884 KB |
Output is correct |
4 |
Correct |
67 ms |
10472 KB |
Output is correct |
5 |
Incorrect |
41 ms |
9316 KB |
Output isn't correct |
6 |
Incorrect |
66 ms |
12068 KB |
Output isn't correct |
7 |
Correct |
29 ms |
9320 KB |
Output is correct |
8 |
Correct |
31 ms |
9308 KB |
Output is correct |
9 |
Correct |
67 ms |
11984 KB |
Output is correct |
10 |
Correct |
64 ms |
11980 KB |
Output is correct |