Submission #844542

# Submission time Handle Problem Language Result Execution time Memory
844542 2023-09-05T14:00:27 Z vjudge1 Spiderman (COCI20_spiderman) C++14
56 / 70
1064 ms 13816 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define int long long

using namespace std;

template<typename T1, typename T2> ostream& operator<<(ostream& os, pair<T1, T2> p){ return os << p.first << " " << p.second; }

void solve(void){
	int n,k, morethank=0;
	cin >> n >> k;
	vector<int> h(n), ans(n, 0);
	for(auto &gh: h){
		cin >> gh;
		if(gh>k)
			morethank++;
	}

	vector<int> bruh(1e6+7, 0);
	for(int i=0; i<n; i++)
		bruh[h[i]]++;

	for(int i=0; i<n; i++){
		int gh = h[i] - k;
		if(gh == 0)
			ans[i] = morethank;

		for(int l=1; l*l<=gh; l++){
			if(gh%l == 0){
				if(l>k)
					ans[i]+= bruh[l];
				if(l*l != gh)
					if( gh/l > k )
						ans[i]+= bruh[gh/l];
					
			}
		}
	}

	for(auto ghh: ans)
		cout << ghh << " ";
	cout << "\n";

}

signed main(){
	int t=1;
//	cin >> t;
	while(t--)
		solve();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 8280 KB Output is correct
2 Correct 7 ms 8280 KB Output is correct
3 Correct 298 ms 10076 KB Output is correct
4 Correct 818 ms 13716 KB Output is correct
5 Incorrect 321 ms 10060 KB Output isn't correct
6 Incorrect 931 ms 13816 KB Output isn't correct
7 Correct 365 ms 9824 KB Output is correct
8 Correct 360 ms 10064 KB Output is correct
9 Correct 1064 ms 13568 KB Output is correct
10 Correct 1062 ms 13460 KB Output is correct