# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199507 | SamAnd | Spiderman (COCI20_spiderman) | C++17 | 130 ms | 10232 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 300005, M = 1000006;
int n, k;
int a[N];
int q[M];
int qq[M];
int main()
{
scanf("%d%d", &n, &k);
for (int i = 1; i <= n; ++i)
{
scanf("%d", &a[i]);
q[a[i]]++;
}
for (int i = 1; i < M; ++i)
{
if (i <= k)
continue;
for (int j = 0; j < M; j += i)
qq[j] += q[i];
}
for (int i = 1; i <= n; ++i)
{
if (a[i] - k < 0)
printf("0 ");
else
{
if (a[i] % a[i] == k)
printf("%d ", qq[a[i] - k] - 1);
else
printf("%d ", qq[a[i] - k]);
}
}
printf("\n");
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |