#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
//#define int long long
#define pii pair<int,int>
#define bg begin
#define vi vector<int>
#define vvi vector<vi>
#define vp vector<pii>
#define ppi pair<pii,int>
#define endl '\n'
#define triple tuple<int,int,int>
#define ppp pair<pii,pii>
#define pip pair<int,pii>
#define vpp vector<ppi>
#define sp << " " <<
#define ff first
#define ss second
#define F(xxx,n) for (int xxx=1;xxx<=n;++xxx)
#define FF(xxx,sss,yyy) for (int xxx=sss;xxx<=yyy;++xxx)
#define pb push_back
const int MOD = 1e9+7;
void solve() {
int n,k;
cin >> n >> k;
vi a(n+1);
F(i,n) cin >> a[i];
vi cnt(1e6+1,0);
F(i,n) cnt[a[i]]++;
vi cur(1e6+1,0);
for (int i=1;i<=1000000;i++) {
if(i > k) {
for (int j=k;j<=1000000;j+=i) cur[j]+=cnt[i];
}
}
for (int i=1;i<=n;i++) {
cout << cur[a[i]] << " ";
}
cout << endl;
}
signed main() {
#ifdef Local
freopen("input.in","r",stdin);
freopen("input.out","w",stdout);
#endif
ios_base::sync_with_stdio(0);cin.tie(0);
int t = 1;
//cin >> t;
while (t--) solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
8280 KB |
Output is correct |
2 |
Correct |
15 ms |
8280 KB |
Output is correct |
3 |
Correct |
26 ms |
8784 KB |
Output is correct |
4 |
Correct |
55 ms |
10324 KB |
Output is correct |
5 |
Incorrect |
28 ms |
8792 KB |
Output isn't correct |
6 |
Incorrect |
51 ms |
10320 KB |
Output isn't correct |
7 |
Correct |
26 ms |
8792 KB |
Output is correct |
8 |
Correct |
27 ms |
8784 KB |
Output is correct |
9 |
Correct |
50 ms |
10068 KB |
Output is correct |
10 |
Correct |
49 ms |
10064 KB |
Output is correct |