Submission #881335

# Submission time Handle Problem Language Result Execution time Memory
881335 2023-12-01T06:59:12 Z ilhan_arda Spiderman (COCI20_spiderman) C++17
56 / 70
1020 ms 6484 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fi first
#define se second
#define pb push_back
#define endl "\n"
//~ #define int long long
using namespace std;
 
typedef tuple<int, int, int> iii;
typedef long long ll;
const int mod =998244353;
 
int n, k;
int a[300005], mp[1000005];
 
int32_t main(){
	fast;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		mp[a[i]]++;
	}
	//~ sort(a+1, a+n+1);
	int temp=-1;
	for(int i=1;i<=n;i++){
		if(a[i]<k){
			cout<<0<<" ";
			continue;
		}
		if(a[i]==1 && !k){
			cout<<n-1<<endl;
		}
		if(a[i]==k && temp==-1){
			temp=n;
			for(int j=1;j<=n;j++){
				if(a[j]<=k)temp--;
			}
			cout<<temp<<" ";
			continue;
		}
		else if(a[i]==k){
			cout<<temp<<" ";
			continue;
		}
		int ans=0;
		a[i]-=k;
		for(int  j=1;j*j<=a[i];j++){
			if(a[i]/j*j==a[i]){
				if(j>k)ans+=mp[j];
				if(j*j!=a[i] && a[i]/j>k)ans+=mp[a[i]/j];
			}
		}
		a[i]+=k;
		cout<<ans<<" ";
	}
	cout<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4700 KB Output is correct
2 Correct 6 ms 4748 KB Output is correct
3 Correct 261 ms 4836 KB Output is correct
4 Correct 766 ms 6484 KB Output is correct
5 Incorrect 303 ms 4972 KB Output isn't correct
6 Incorrect 882 ms 6316 KB Output isn't correct
7 Correct 346 ms 4952 KB Output is correct
8 Correct 341 ms 4784 KB Output is correct
9 Correct 1020 ms 6136 KB Output is correct
10 Correct 1014 ms 6396 KB Output is correct