#include<bits/stdc++.h>
using namespace std;
int main(){
long long a,b,c,d,e,p,h;
map <long long, int> mp;
vector <long long> arr;
cin>>a>>c;
p=a;
h=0;
while(a--){
cin>>b;
mp[b]++;
arr.push_back(b);
if(b > c){
h++;
}
}
for(long long i=0;p>i;i++){
if(arr[i] <= 2*c){
if(arr[i] == c){
e=h;
}
else{
e=0;
}
}
else{
e=0;
d=arr[i];
d-=c;
for(long long j=1; d >= (j*j);j++){
if(d % j == 0 ){
if(arr[i] % j == c){
e+=mp[j];
}
if(arr[i] % (d / j) == c){
e+=mp[d / j];
}
if(j == (d/j)){
e-=mp[j];
}
}
}
if(c == 0){
e-=1;
}
}
cout<<e<<" ";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
860 KB |
Output isn't correct |
2 |
Incorrect |
8 ms |
600 KB |
Output isn't correct |
3 |
Correct |
349 ms |
2016 KB |
Output is correct |
4 |
Incorrect |
986 ms |
5572 KB |
Output isn't correct |
5 |
Correct |
580 ms |
11116 KB |
Output is correct |
6 |
Correct |
1617 ms |
13056 KB |
Output is correct |
7 |
Incorrect |
672 ms |
17292 KB |
Output isn't correct |
8 |
Incorrect |
643 ms |
16900 KB |
Output isn't correct |
9 |
Incorrect |
1748 ms |
20340 KB |
Output isn't correct |
10 |
Incorrect |
1765 ms |
19164 KB |
Output isn't correct |