#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const int mxn = 3e6+10;
int cnt[mxn],ans[mxn];
int n,k;
int arr[mxn];
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n>>k;
for(int i = 1;i<=n;i++){
cin>>arr[i];
cnt[arr[i]]++;
}
for(int i = 1;i<mxn/3;i++){
if(i<=k)continue;
for(int j = 0;j*i+k<mxn;j++){
ans[i*j+k] += cnt[i];
if(i*j+k == 12&&cnt[i] != 0)cout<<i<<' '<<j<<' '<<k<<endl;
}
if(!k)ans[i]--;
}
for(int i = 1;i<=n;i++)cout<<ans[arr[i]]<<' ';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
18928 KB |
Output is correct |
2 |
Incorrect |
50 ms |
18780 KB |
Output isn't correct |
3 |
Incorrect |
64 ms |
21848 KB |
Output isn't correct |
4 |
Correct |
88 ms |
23672 KB |
Output is correct |
5 |
Incorrect |
70 ms |
21844 KB |
Output isn't correct |
6 |
Incorrect |
97 ms |
23820 KB |
Output isn't correct |
7 |
Correct |
53 ms |
21844 KB |
Output is correct |
8 |
Incorrect |
189 ms |
23052 KB |
Output isn't correct |
9 |
Incorrect |
116 ms |
23636 KB |
Output isn't correct |
10 |
Correct |
84 ms |
23632 KB |
Output is correct |