Submission #844536

# Submission time Handle Problem Language Result Execution time Memory
844536 2023-09-05T13:58:34 Z vjudge1 Spiderman (COCI20_spiderman) C++14
56 / 70
1062 ms 13816 KB
#include <bits/stdc++.h>

#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 8284 KB Output is correct
3 Correct 280 ms 10076 KB Output is correct
4 Correct 822 ms 13720 KB Output is correct
5 Incorrect 318 ms 10064 KB Output isn't correct
6 Incorrect 931 ms 13816 KB Output isn't correct
7 Correct 358 ms 9808 KB Output is correct
8 Correct 369 ms 10068 KB Output is correct
9 Correct 1061 ms 13716 KB Output is correct
10 Correct 1062 ms 13580 KB Output is correct