# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
231820 | CodeTiger927 | Spiderman (COCI20_spiderman) | C++14 | 1654 ms | 14936 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
using namespace std;
#include <iostream>
#include <unordered_map>
#include <cmath>
unordered_map<int,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[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) {
ans[i] += us[j];
}
if(counter > K && counter != j) {
ans[i] += us[counter];
}
}
}
if(K == 0) {
--ans[i];
}
}
for(int i = 0;i < N;i++) {
cout << ans[i] << " ";
}
cout << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |