#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;
if(mp[1] != 0 && (arr[i] % (1) == c)){
e+=mp[1];
}
if(mp[d] != 0 && (arr[i] % (d) == c)){
e+=mp[d];
if(i == d){
e-=mp[1];
}
}
for(long long j=2; sqrt(d) >= j;j++){
if(d % j == 0){
e+=mp[j];
e+=mp[d / j];
if(j == (d/j)){
e-=mp[j];
}
}
}
}
cout<<e<<" ";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
856 KB |
Output isn't correct |
2 |
Incorrect |
8 ms |
600 KB |
Output isn't correct |
3 |
Correct |
343 ms |
1988 KB |
Output is correct |
4 |
Incorrect |
991 ms |
6084 KB |
Output isn't correct |
5 |
Incorrect |
575 ms |
10976 KB |
Output isn't correct |
6 |
Incorrect |
1605 ms |
12748 KB |
Output isn't correct |
7 |
Incorrect |
734 ms |
17324 KB |
Output isn't correct |
8 |
Incorrect |
675 ms |
17200 KB |
Output isn't correct |
9 |
Incorrect |
1743 ms |
20160 KB |
Output isn't correct |
10 |
Incorrect |
1724 ms |
20560 KB |
Output isn't correct |