Submission #1017196

# Submission time Handle Problem Language Result Execution time Memory
1017196 2024-07-09T06:01:55 Z vjudge1 Spiderman (COCI20_spiderman) C++17
56 / 70
88 ms 11088 KB
#include <bits/stdc++.h>
using namespace std;

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

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

int 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;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 7516 KB Output is correct
2 Correct 7 ms 6492 KB Output is correct
3 Correct 31 ms 8280 KB Output is correct
4 Correct 73 ms 9812 KB Output is correct
5 Incorrect 42 ms 9760 KB Output isn't correct
6 Incorrect 85 ms 11088 KB Output isn't correct
7 Correct 34 ms 9668 KB Output is correct
8 Correct 37 ms 9808 KB Output is correct
9 Correct 85 ms 11088 KB Output is correct
10 Correct 88 ms 10904 KB Output is correct