Click Here to go back to the homepage.

Booking a Room Solution:


#include <bits/stdc++.h>
using namespace std;

int main(){
    // #ifndef TESTING
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    int n_rooms, n_rooms_booked;
    cin >> n_rooms >> n_rooms_booked;
    unordered_set<int> rooms ({n_rooms});
    while(--n_rooms){
        rooms.insert(n_rooms);
    }
    int room;
    while(n_rooms_booked--){
        cin >> room;
        rooms.erase(room);
    }
    if(rooms.size()){
        cout << *rooms.begin();
    } else {
        cout << "too late";
    }

    return 0;
}