#include <bits/stdc++.h>
using namespace std;
#define int long long int
const int MAX = 2e6 + 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 |
50 ms |
19124 KB |
Output is correct |
2 |
Correct |
53 ms |
17756 KB |
Output is correct |
3 |
Correct |
64 ms |
20364 KB |
Output is correct |
4 |
Correct |
83 ms |
22460 KB |
Output is correct |
5 |
Incorrect |
72 ms |
24912 KB |
Output isn't correct |
6 |
Incorrect |
93 ms |
27048 KB |
Output isn't correct |
7 |
Correct |
59 ms |
24916 KB |
Output is correct |
8 |
Correct |
65 ms |
24744 KB |
Output is correct |
9 |
Correct |
91 ms |
27056 KB |
Output is correct |
10 |
Correct |
86 ms |
26976 KB |
Output is correct |