```
int findRadius(vector<int>& houses, vector<int>& heaters) {
sort(houses.begin(),houses.end());
sort(heaters.begin(),heaters.end());
int i=0,rad=0;
for(int x:houses){
while(i<heaters.size()-1&&heaters[i]+heaters[i+1]<=x*2) i++;
rad=max(rad,abs(heaters[i]-x));
}
return rad;
}
```