제출 #1092748

#제출 시각아이디문제언어결과실행 시간메모리
1092748Hacv16Spiderman (COCI20_spiderman)C++17
56 / 70
93 ms27056 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long int

const int MAX = 2e6 + 10;

int n, k, v[MAX];
int resp[MAX], freq[MAX];

int32_t main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> n >> k;

	for(int i = 1; i <= n; i++)
	{
		cin >> v[i];
		freq[ v[i] ]++;
	}

	for(int i = 1; i < MAX; i++)
		for(int j = 0; j * i + k < MAX; j++)
			if(k < i) resp[j * i + k] += freq[i];

	for(int i = 1; i <= n; i++)
		cout << resp[ v[i] ] << ' ';

	cout << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...