Submission #440579

#TimeUsernameProblemLanguageResultExecution timeMemory
440579colossal_pepeSpiderman (COCI20_spiderman)C++17
70 / 70
167 ms10176 KiB
#include <iostream>
using namespace std;

int n, k, city[300005], cnt[1000005], divisors[1000005];

int main() {
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> city[i];
        cnt[city[i]] += 1;
    }
    for (int i = k + 1; i < 1000005; i++) {
        for (int j = 0; j < 1000005; j += i) {
            divisors[j] += cnt[i];
        }
    }
    for (int i = 0; i < n; i++) {
        cout << (city[i] >= k ? divisors[city[i] - k] - (k == 0): 0) << ' ';
    }
    cout << endl;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...