#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long a,b,c,d,e,p,h;
int mp[1000005];
memset(mp,0,sizeof(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] <= 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<<" ";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
4184 KB |
Output isn't correct |
2 |
Incorrect |
7 ms |
4396 KB |
Output isn't correct |
3 |
Incorrect |
272 ms |
5604 KB |
Output isn't correct |
4 |
Incorrect |
794 ms |
9172 KB |
Output isn't correct |
5 |
Correct |
312 ms |
5720 KB |
Output is correct |
6 |
Correct |
906 ms |
8656 KB |
Output is correct |
7 |
Incorrect |
352 ms |
5496 KB |
Output isn't correct |
8 |
Incorrect |
355 ms |
5484 KB |
Output isn't correct |
9 |
Incorrect |
1039 ms |
9168 KB |
Output isn't correct |
10 |
Incorrect |
1034 ms |
10184 KB |
Output isn't correct |