# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
519669 | KoD | Spiderman (COCI20_spiderman) | C++17 | 89 ms | 12116 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 std::vector;
using std::array;
using std::pair;
using std::tuple;
constexpr int MAX = 1000000;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int N, K;
std::cin >> N >> K;
vector<int> H(N);
vector<int> count(MAX + 1);
for (auto& x : H) {
std::cin >> x;
count[x] += 1;
}
vector<int> ans(MAX + 1);
for (int dst = K + 1; dst <= MAX; ++dst) {
for (int src = K; src <= MAX; src += dst) {
ans[src] += count[dst];
}
}
for (int i = 0; i < N; ++i) {
std::cout << ans[H[i]] - (K == 0) << " \n"[i + 1 == N];
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |