Submission #519669

#TimeUsernameProblemLanguageResultExecution timeMemory
519669KoDSpiderman (COCI20_spiderman)C++17
70 / 70
89 ms12116 KiB
#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 timeMemoryGrader output
Fetching results...