#include<bits/stdc++.h>
using namespace std;
int main(){
long long a,b,c,d,e,p,h;
int mp[300000];
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] <= 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<<" ";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
2908 KB |
Execution killed with signal 11 |
2 |
Runtime error |
2 ms |
2904 KB |
Execution killed with signal 11 |
3 |
Runtime error |
2 ms |
2904 KB |
Execution killed with signal 11 |
4 |
Runtime error |
2 ms |
2908 KB |
Execution killed with signal 11 |
5 |
Runtime error |
2 ms |
2908 KB |
Execution killed with signal 11 |
6 |
Runtime error |
2 ms |
2904 KB |
Execution killed with signal 11 |
7 |
Runtime error |
3 ms |
2908 KB |
Execution killed with signal 11 |
8 |
Runtime error |
3 ms |
2908 KB |
Execution killed with signal 11 |
9 |
Runtime error |
2 ms |
2908 KB |
Execution killed with signal 11 |
10 |
Runtime error |
2 ms |
2904 KB |
Execution killed with signal 11 |