답안 #732877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
732877 2023-04-29T11:11:50 Z vjudge1 Spiderman (COCI20_spiderman) C++17
56 / 70
1845 ms 19316 KB
#include<bits/stdc++.h>
#define int long long
#define MOD 1000000007
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int32_t main(){
	fast;
	int n,k;
	cin>>n>>k;
	int arr[n],cnt=0;
	map<int,int>mp;
	for(int i=0;i<n;i++){
		cin>>arr[i];
		if(arr[i]>k)cnt++;
		mp[arr[i]]++;
	}
	for(int i=0;i<n;i++){
		if(arr[i]==k){
			cout<<cnt<<" ";
			continue;
		}
		int ans=0;
		arr[i]-=k;
		for(int j=1;j*j<=arr[i];j++){
			if(arr[i]%j)continue;
			if(j>k)ans+=mp[j];
			if(arr[i]/j>k && j*j!=arr[i])ans+=mp[arr[i]/j];
		}
		cout<<ans<<" ";
	}
	cout<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 852 KB Output is correct
2 Correct 8 ms 596 KB Output is correct
3 Correct 365 ms 2088 KB Output is correct
4 Correct 1044 ms 4284 KB Output is correct
5 Incorrect 641 ms 11056 KB Output isn't correct
6 Incorrect 1797 ms 12440 KB Output isn't correct
7 Correct 712 ms 17224 KB Output is correct
8 Correct 730 ms 17012 KB Output is correct
9 Correct 1812 ms 19316 KB Output is correct
10 Correct 1845 ms 19116 KB Output is correct