3
int maxBuilding(int n, vector<vector<int>> &restrictions) {4
restrictions.push_back({1, 0});5
restrictions.push_back({n, n - 1});6
sort(restrictions.begin(), restrictions.end());7
for (int i = restrictions.size() - 2; i >= 0; --i) {8
restrictions[i][1] = min(9
restrictions[i][1], restrictions[i + 1][1] + restrictions[i + 1][0] - restrictions[i][0]);13
for (int i = 1; i < restrictions.size(); ++i) {14
restrictions[i][1] = min(15
restrictions[i][1], restrictions[i - 1][1] + restrictions[i][0] - restrictions[i - 1][0]);16
ans = max(ans, (restrictions[i - 1][1] + restrictions[i][0] - restrictions[i - 1][0] +