#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n; i>=0; i--)
#define FOREACH(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); i++)
#define st first
#define fi first
#define nd second
#define se second
#define vi vector<int>
#define vii vector< vi >
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define endl "\n"
int N, K;
int Arr[300000];
int Ocur[1000100];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> N >> K;
REP(i, N){
cin >> Arr[i];
if(Arr[i] > K){
for(int s = K; s <= 1000100; s+=Arr[i])
Ocur[s]++;
}
}
REP(i, N){
cout << Ocur[Arr[i]] - (K == 0 ? 1 : 0) << " ";
}
cout << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
4344 KB |
Output is correct |
2 |
Correct |
14 ms |
4344 KB |
Output is correct |
3 |
Correct |
338 ms |
5620 KB |
Output is correct |
4 |
Correct |
703 ms |
8256 KB |
Output is correct |
5 |
Correct |
43 ms |
5496 KB |
Output is correct |
6 |
Correct |
118 ms |
8260 KB |
Output is correct |
7 |
Correct |
41 ms |
5496 KB |
Output is correct |
8 |
Correct |
40 ms |
5496 KB |
Output is correct |
9 |
Correct |
127 ms |
8184 KB |
Output is correct |
10 |
Correct |
116 ms |
8184 KB |
Output is correct |