#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 10;
int n, k, v[MAX];
int resp[MAX], freq[MAX];
int32_t main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> k;
for(int i = 1; i <= n; i++)
{
cin >> v[i];
freq[ v[i] ]++;
}
for(int i = 1; i < MAX; i++)
for(int j = 0; j * i + k < MAX; j++)
if(k < i) resp[j * i + k] += freq[i];
for(int i = 1; i <= n; i++)
cout << resp[ v[i] ] << ' ';
cout << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
6504 KB |
Output is correct |
2 |
Correct |
19 ms |
5736 KB |
Output is correct |
3 |
Correct |
30 ms |
8028 KB |
Output is correct |
4 |
Correct |
51 ms |
10588 KB |
Output is correct |
5 |
Incorrect |
33 ms |
9564 KB |
Output isn't correct |
6 |
Incorrect |
53 ms |
12124 KB |
Output isn't correct |
7 |
Correct |
29 ms |
9320 KB |
Output is correct |
8 |
Correct |
33 ms |
9320 KB |
Output is correct |
9 |
Correct |
55 ms |
12128 KB |
Output is correct |
10 |
Correct |
58 ms |
11928 KB |
Output is correct |