#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define all(aa) aa.begin(), aa.end()
int main(){
int n, k;
cin>>n>>k;
vector<int> v(n), sieve(1000001);
for(int &e:v){
cin>>e;
if(e>k) for(int j=0; j<=1000000; j+=e) sieve[j]++;
}
for(auto e:v) {
if(e<k) cout<<0<<' ';
else cout<<sieve[e-k]-(e!=k && k%e==0)<<' ';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
4184 KB |
Output is correct |
2 |
Correct |
8 ms |
4184 KB |
Output is correct |
3 |
Correct |
331 ms |
4944 KB |
Output is correct |
4 |
Correct |
643 ms |
6276 KB |
Output is correct |
5 |
Correct |
40 ms |
4944 KB |
Output is correct |
6 |
Correct |
118 ms |
6288 KB |
Output is correct |
7 |
Correct |
35 ms |
5004 KB |
Output is correct |
8 |
Correct |
38 ms |
4944 KB |
Output is correct |
9 |
Correct |
125 ms |
6224 KB |
Output is correct |
10 |
Correct |
111 ms |
6224 KB |
Output is correct |