답안 #1017198

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

#define int long long
int const N=1e6+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])
			ans[j]+=cnt[arr[i]];
	}
	for(int i=0;i<n;i++)
		cout<<ans[arr[i]]<<' ';
	cout<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 12124 KB Output is correct
2 Correct 9 ms 10588 KB Output is correct
3 Correct 34 ms 13208 KB Output is correct
4 Correct 77 ms 15444 KB Output is correct
5 Incorrect 42 ms 18000 KB Output isn't correct
6 Incorrect 90 ms 20304 KB Output isn't correct
7 Correct 43 ms 18020 KB Output is correct
8 Correct 41 ms 18000 KB Output is correct
9 Correct 98 ms 20084 KB Output is correct
10 Correct 91 ms 19904 KB Output is correct