Submission #1265692

#TimeUsernameProblemLanguageResultExecution timeMemory
1265692goulthenSpiderman (COCI20_spiderman)C++20
70 / 70
56 ms19272 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define per(i,a,b) for(int i=a;i>=b;--i)
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second

const int MAXN = 3e5 + 10;
const int MAXK = 1e6 + 10;
int a[MAXN], ans[MAXK], cnt[MAXK];


int32_t main(){
	ios::sync_with_stdio(0);cin.tie(0);
	int n,k;cin >> n >> k;
	rep(i,1,n) cin >> a[i];
	rep(i,1,n) cnt[a[i]]++;

	rep(K,k+1,MAXK-1) {
		if (!cnt[K]) continue;
		
		for (int y = k; y <= MAXK; y += K) {
			ans[y] += cnt[K];
		}
	}

	rep(i,1,n) cout << ans[a[i]]-(k==0) << " \n"[i==n];
	
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...