Submission #878463

# Submission time Handle Problem Language Result Execution time Memory
878463 2023-11-24T12:31:21 Z vjudge1 Spiderman (COCI20_spiderman) C++17
0 / 70
3 ms 4856 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, ans;
int a[300005], mp[300005];
vector<int> p;

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);
	for(int i=1;i<=n;i++){
		if(a[i]<k){
			cout<<0<<" ";
			continue;
		}
		if(a[i]==k){
			cout<<n-i<<" ";
			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];
				
			}
		}
		cout<<ans<<" ";
	}
	cout<<endl;
}




# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 4856 KB Execution killed with signal 11
2 Runtime error 3 ms 4700 KB Execution killed with signal 11
3 Runtime error 2 ms 4700 KB Execution killed with signal 11
4 Runtime error 2 ms 4696 KB Execution killed with signal 11
5 Runtime error 2 ms 4572 KB Execution killed with signal 11
6 Runtime error 2 ms 4700 KB Execution killed with signal 11
7 Runtime error 3 ms 4824 KB Execution killed with signal 11
8 Runtime error 2 ms 4700 KB Execution killed with signal 11
9 Runtime error 2 ms 4700 KB Execution killed with signal 11
10 Runtime error 2 ms 4700 KB Execution killed with signal 11