3
int maxNumberOfFamilies(int n, vector<vector<int>> &reservedSeats) {4
unordered_map<int, vector<int>> o;6
for (auto r : reservedSeats) {7
o[r[0]].push_back(r[1]);10
int ans = 2 * (n - o.size()); // seats with no occupancy directly adding 212
// if we iterate from 1 to n (10 ^ 9) we cross time limit15
vector<int> seats = p.second;17
int occupied_mask = 0;19
// representing occupied seats as bits21
if (s > 1 && s < 10) {22
occupied_mask += (int)pow(2, 10 - s);26
// checking 3 seating configurations27
int masks[3] = {480, 120, 30};30
bool res1 = (masks[0] & occupied_mask) == 0;31
bool res2 = (masks[1] & occupied_mask) == 0;32
bool res3 = (masks[2] & occupied_mask) == 0;34
// if all 3 configurations are empty, 2 families35
// if either one of them are empty, 1 family36
if (res1 && res2 && res3)38
else if (res1 || res2 || res3)