# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
198406 | ZwariowanyMarcin | Spiderman (COCI20_spiderman) | C++14 | 136 ms | 10360 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>
#define fi first
#define se second
#define mp make_pair
#define ss(x) (int) x.size()
#define pb push_back
#define LL long long
#define ld long double
#define cat(x) cerr << #x << " = " << x << endl
#define FOR(i, j, n) for(int i = j; i <= n; ++i)
#define boost cin.tie(0), ios_base::sync_with_stdio(0);
using namespace std;
const int nax = 1e6 + 100;
int n, k;
int a[nax];
int w[nax];
int res[nax];
int main() {
scanf ("%d%d", &n, &k);
for (int i = 1; i <= n; ++i) {
scanf ("%d", a + i);
w[a[i]]++;
}
for (int i = 1; i < nax; ++i) {
if (!w[i] || i <= k) continue;
for (int j = k; j < nax; j += i)
res[j] += w[i];
if (!k) res[i] -= 1;
}
for (int i = 1; i <= n; ++i)
printf ("%d ", res[a[i]]);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |