# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199507 | 2020-02-01T17:14:22 Z | SamAnd | Spiderman (COCI20_spiderman) | C++17 | 130 ms | 10232 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 6520 KB | Output is correct |
2 | Correct | 28 ms | 5624 KB | Output is correct |
3 | Correct | 51 ms | 7288 KB | Output is correct |
4 | Correct | 105 ms | 8672 KB | Output is correct |
5 | Correct | 60 ms | 8712 KB | Output is correct |
6 | Correct | 130 ms | 10232 KB | Output is correct |
7 | Correct | 57 ms | 8696 KB | Output is correct |
8 | Correct | 56 ms | 8824 KB | Output is correct |
9 | Correct | 110 ms | 10104 KB | Output is correct |
10 | Correct | 123 ms | 10104 KB | Output is correct |