#include<bits/stdc++.h>
using namespace std;
int n, k, a[1000000], ans[1000000], maxx = -1e9;
map<int, int> cnt;
void in(){
cin >> n >> k;
for(int i = 1; i <= n; i++) {
cin >> a[i];
cnt[a[i]]++;
maxx = max(maxx, a[i]);
}
}
void solve(){
for(auto i : cnt){
if(i.first <= k) continue;
for(int j = k; j <= maxx; j += i.first){
ans[j] += i.second;
}
}
for(int i = 1; i <= n; i++) cout << ans[a[i]] << ' ';
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int t;
t = 1;
while(t--){
in();
solve();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
4352 KB |
Output is correct |
2 |
Correct |
6 ms |
4308 KB |
Output is correct |
3 |
Correct |
28 ms |
5592 KB |
Output is correct |
4 |
Correct |
66 ms |
8140 KB |
Output is correct |
5 |
Incorrect |
73 ms |
10196 KB |
Output isn't correct |
6 |
Incorrect |
135 ms |
12400 KB |
Output isn't correct |
7 |
Correct |
63 ms |
10156 KB |
Output is correct |
8 |
Correct |
66 ms |
10188 KB |
Output is correct |
9 |
Correct |
133 ms |
12344 KB |
Output is correct |
10 |
Correct |
152 ms |
12332 KB |
Output is correct |