#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6+5;
int n, k;
int cnt[N],ans[N];
void seive (){
for(int i=k+1;i<N;i++)
for(int j=k;j<N;j+=i)
ans[j] += cnt[i];
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>n>>k;
vector<int>a(n);
for(auto&it:a){
cin>>it;
cnt[it]++;
}
seive();
for(int i=0;i<n;i++)
cout<<ans[a[i]]<<' ';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
6484 KB |
Output is correct |
2 |
Correct |
14 ms |
5688 KB |
Output is correct |
3 |
Correct |
32 ms |
7496 KB |
Output is correct |
4 |
Correct |
68 ms |
9176 KB |
Output is correct |
5 |
Incorrect |
36 ms |
8912 KB |
Output isn't correct |
6 |
Incorrect |
64 ms |
10516 KB |
Output isn't correct |
7 |
Correct |
30 ms |
8992 KB |
Output is correct |
8 |
Correct |
32 ms |
9136 KB |
Output is correct |
9 |
Correct |
76 ms |
10392 KB |
Output is correct |
10 |
Correct |
65 ms |
10400 KB |
Output is correct |