Submission #231815

# Submission time Handle Problem Language Result Execution time Memory
231815 2020-05-15T00:29:34 Z CodeTiger927 Spiderman (COCI20_spiderman) C++14
21 / 70
1578 ms 9136 KB
using namespace std;

#include <iostream>
#include <unordered_set>
#include <cmath>

unordered_set<int> us;
int zero = 0;
int arr[300005];
int ans[300005];

int main() {
	int N,K;
	cin >> N >> K;
	for(int i = 0;i < N;i++) {
		int cur;
		cin >> cur;
		arr[i] = cur;
		us.insert(cur);
		if(cur > K) {
			zero++;
		}
	}
	for(int i = 0;i < N;++i) {
		int cur = arr[i] - K;
		if(cur < 0) {
			continue;
		}else if(cur == 0) {
			ans[i] = zero;
			continue;
		}
		for(int j = 1;j <= sqrt(cur);++j) {
			if(cur % j == 0) {
				int counter = cur / j;
				if(j > K && us.count(j)) ++ans[i];
				if(counter > K && counter != j && us.count(counter)) ++ans[i];
			}
		}
	}
	for(int i = 0;i < N;i++) {
		cout << ans[i] << " ";
	}
	cout << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 13 ms 512 KB Output is correct
2 Incorrect 12 ms 384 KB Output isn't correct
3 Incorrect 394 ms 2168 KB Output isn't correct
4 Incorrect 1122 ms 5264 KB Output isn't correct
5 Incorrect 517 ms 6024 KB Output isn't correct
6 Incorrect 1473 ms 9132 KB Output isn't correct
7 Correct 543 ms 6152 KB Output is correct
8 Correct 544 ms 6024 KB Output is correct
9 Incorrect 1578 ms 9136 KB Output isn't correct
10 Incorrect 1573 ms 9096 KB Output isn't correct