Submission #1017197

# Submission time Handle Problem Language Result Execution time Memory
1017197 2024-07-09T06:02:22 Z vjudge1 Spiderman (COCI20_spiderman) C++17
56 / 70
85 ms 10188 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 3e5 + 10, A = 1e6 + 10;
int n, k, a[N], cnt[A], ans[A];

int main(){
    cin >> n >> k;
    for (int i = 0; i < n; i ++)
        cin >> a[i], cnt[a[i]]++;

    for (int i = 0; i < n; i ++){
        if (cnt[a[i]] == 0 or k >= a[i]) continue;
        for (int r = k; r <= 1e6; r += a[i])
            ans[r] += cnt[a[i]];
        cnt[a[i]] = 0;
    }

    for (int i = 0; i < n; i ++)
        cout << ans[a[i]] << " ";
    cout << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 6488 KB Output is correct
2 Correct 6 ms 5724 KB Output is correct
3 Correct 36 ms 7356 KB Output is correct
4 Correct 71 ms 8756 KB Output is correct
5 Incorrect 44 ms 8784 KB Output isn't correct
6 Incorrect 85 ms 10180 KB Output isn't correct
7 Correct 46 ms 8656 KB Output is correct
8 Correct 36 ms 8788 KB Output is correct
9 Correct 85 ms 10188 KB Output is correct
10 Correct 84 ms 10068 KB Output is correct