Submission #565383

# Submission time Handle Problem Language Result Execution time Memory
565383 2022-05-20T20:27:31 Z faruk Spiderman (COCI20_spiderman) C++17
56 / 70
160 ms 12408 KB
#include <bits/stdc++.h>
#define pii pair<int, int>
#define ll long long
#define ld long double

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, k;
    cin >> n >> k;

    vector<int> mark(1e6 + 1, 0);
    map<int, int> histo;
    vector<int> arr;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        histo[x]++;
        arr.push_back(x);
    }

    for (pii x : histo) {
        if (x.first < k || x.first == k)
            continue;
        for (int i = k; i <= 1e6; i += x.first)
            mark[i] += x.second;
    }

    for (int i = 0; i < n - 1; i++)
    {
        if (k == 0)
            cout << mark[arr[i]] + histo[1] <<" ";
        else
            cout << mark[arr[i]] << " ";
    }

    if (k == 0)
        cout << mark[arr[n - 1]] + histo[1] << "\n";
    else
        cout << mark[arr[n - 1]] << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 4308 KB Output is correct
2 Correct 5 ms 4308 KB Output is correct
3 Correct 26 ms 5748 KB Output is correct
4 Correct 68 ms 8336 KB Output is correct
5 Incorrect 79 ms 10152 KB Output isn't correct
6 Incorrect 160 ms 12408 KB Output isn't correct
7 Correct 62 ms 10104 KB Output is correct
8 Correct 66 ms 10124 KB Output is correct
9 Correct 138 ms 12332 KB Output is correct
10 Correct 128 ms 12264 KB Output is correct