답안 #1017201

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1017201 2024-07-09T06:08:20 Z vjudge1 Spiderman (COCI20_spiderman) C++17
70 / 70
127 ms 27996 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
int const N=2e6+5;
int const mod=1e9+7;

bool upd[N];
int cnt[N];
int ans[N];

signed main(){
	int n,k;
	cin>>n>>k;
	int arr[n];
	for (int i = 0; i < n; ++i){
		cin>>arr[i];
		cnt[arr[i]]++;
	}
	for (int i = 0; i < n; ++i)
	{
		if(upd[arr[i]]>0 || arr[i]<=k)
			continue;
		upd[arr[i]]=1;
		for(int j=k;j<N;j+=arr[i]){
			if(arr[i]==j)
				ans[j]--;
			ans[j]+=cnt[arr[i]];
		}
	}
	for(int i=0;i<n;i++)
		cout<<ans[arr[i]]<<' ';
	cout<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 20060 KB Output is correct
2 Correct 20 ms 18524 KB Output is correct
3 Correct 47 ms 21096 KB Output is correct
4 Correct 87 ms 23264 KB Output is correct
5 Correct 80 ms 25676 KB Output is correct
6 Correct 124 ms 27996 KB Output is correct
7 Correct 71 ms 25684 KB Output is correct
8 Correct 69 ms 25684 KB Output is correct
9 Correct 121 ms 27988 KB Output is correct
10 Correct 127 ms 27952 KB Output is correct