Submission #701156

#TimeUsernameProblemLanguageResultExecution timeMemory
701156rinhoSpiderman (COCI20_spiderman)C++14
56 / 70
152 ms12400 KiB
#include<bits/stdc++.h>
using namespace std;

int n, k, a[1000000], ans[1000000], maxx = -1e9;
map<int, int> cnt;
void in(){
    cin >> n >> k;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        cnt[a[i]]++;
        maxx = max(maxx, a[i]);
    }
}
void solve(){
    for(auto i : cnt){
        if(i.first <= k) continue;
        for(int j = k; j <= maxx; j += i.first){
            ans[j] += i.second;
        }
    }
    for(int i = 1; i <= n; i++) cout << ans[a[i]] << ' ';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    t = 1;
    while(t--){
        in();
        solve();
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...