답안 #519669

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
519669 2022-01-27T02:56:36 Z KoD Spiderman (COCI20_spiderman) C++17
70 / 70
89 ms 12116 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 8180 KB Output is correct
2 Correct 32 ms 8120 KB Output is correct
3 Correct 56 ms 9332 KB Output is correct
4 Correct 69 ms 11972 KB Output is correct
5 Correct 44 ms 9388 KB Output is correct
6 Correct 89 ms 12116 KB Output is correct
7 Correct 51 ms 9308 KB Output is correct
8 Correct 62 ms 9340 KB Output is correct
9 Correct 74 ms 11912 KB Output is correct
10 Correct 80 ms 11904 KB Output is correct