Submission #440579

# Submission time Handle Problem Language Result Execution time Memory
440579 2021-07-02T13:25:09 Z colossal_pepe Spiderman (COCI20_spiderman) C++17
70 / 70
167 ms 10176 KB
#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 time Memory Grader output
1 Correct 19 ms 6476 KB Output is correct
2 Correct 22 ms 5652 KB Output is correct
3 Correct 64 ms 7168 KB Output is correct
4 Correct 147 ms 8600 KB Output is correct
5 Correct 71 ms 8672 KB Output is correct
6 Correct 164 ms 10176 KB Output is correct
7 Correct 67 ms 8644 KB Output is correct
8 Correct 71 ms 8656 KB Output is correct
9 Correct 164 ms 10028 KB Output is correct
10 Correct 167 ms 9928 KB Output is correct