Efficient Optimal Greedy Algorithms for Room Allocation