Submission #735082

# Submission time Handle Problem Language Result Execution time Memory
735082 2023-05-03T13:24:01 Z vjudge1 Spiderman (COCI20_spiderman) C++17
63 / 70
164 ms 17648 KB
// author: MisterReaper (Ahmet Alp Orakci)
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int MAXH = 1e6 + 5;

#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    #include "debug.h"
    #define OPEN freopen(".in", "r", stdin); freopen(".out", "w", stdout);
    #define TIME cerr << "\n" << fixed << setprecision(2) << 1000.0 * clock() / CLOCKS_PER_SEC << " milliseconds ";
#else
    #define debug(...) void(23)
    #define OPEN void(0000)
    #define TIME void(232323233)
#endif

int ans[MAXH];
void solve()
{
    int n, k; cin >> n >> k;
    int arr[n];
    for(int &i : arr) cin >> i;

    map <int, int> mp;
    for(int i  : arr) mp[i]++;

    for(auto i : mp)
    {
        if(i.first <= k) continue;
        for(int j = k; j < MAXH; j += i.first)
            ans[j] += i.second;
        
        if(k == 0) ans[i.first] -= i.second;
    }

    for(int i : arr) cout << ans[i] << " ";
    
    return;
}

int32_t main()
{
    OPEN;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t = 1; //cin >> t;
    while(t--)
    {
        solve();
    }

    TIME;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 12 ms 8276 KB Output is correct
2 Correct 13 ms 8240 KB Output is correct
3 Correct 39 ms 9884 KB Output is correct
4 Correct 77 ms 12272 KB Output is correct
5 Correct 102 ms 15940 KB Output is correct
6 Incorrect 164 ms 17648 KB Output isn't correct
7 Correct 87 ms 15944 KB Output is correct
8 Correct 103 ms 16000 KB Output is correct
9 Correct 156 ms 17620 KB Output is correct
10 Correct 164 ms 17600 KB Output is correct