답안 #844550

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
844550 2023-09-05T14:06:40 Z vjudge1 Spiderman (COCI20_spiderman) C++14
0 / 70
1071 ms 13904 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 && l!=1)
					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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 8280 KB Output isn't correct
2 Incorrect 7 ms 8536 KB Output isn't correct
3 Incorrect 279 ms 10076 KB Output isn't correct
4 Incorrect 816 ms 13904 KB Output isn't correct
5 Incorrect 318 ms 10064 KB Output isn't correct
6 Incorrect 935 ms 13720 KB Output isn't correct
7 Incorrect 369 ms 9904 KB Output isn't correct
8 Incorrect 361 ms 9816 KB Output isn't correct
9 Incorrect 1071 ms 13904 KB Output isn't correct
10 Incorrect 1068 ms 13460 KB Output isn't correct