Gridland Metro

Sort by

recency

|

417 Discussions

|

  • + 0 comments
    def gridlandMetro(n, m, k, track):
        bins = defaultdict(list)
        # match each track interval to its row
        for t, s, e in track:
            bins[t].append([s, e])
        # initially we have the whole grid available
        ans = m * n
        for b in bins.values():
            # sort the intervals by start time/position
            b.sort()
            gap = 0
            l_bound, r_bound = b[0]
            for i in range(1, len(b)):
                # the intervals overlap - combine them
                if b[i][0] <= r_bound:
                    l_bound = min(l_bound, b[i][0])
                    r_bound = max(r_bound, b[i][1])
                # the intervals don't overlap - we need to remove space from the grid
                else:
                    gap += r_bound - l_bound + 1
                    l_bound, r_bound = b[i]
            # the final interval won't be handled in the loop
            gap += r_bound - l_bound + 1
            ans -= gap
            
        return ans
    
  • + 0 comments

    The int in the boilercode needs to be changed to long. Some of the test cases have large n and m, and result will exceed 32bits (int size).

  • + 0 comments

    test cases are not flushed out- i got away with writing bad code.

    test case needed:

    4 10 3 8 3 5 8 7 8 8 4 8

  • + 0 comments

    Is it expected that the C++ boilerplate does not parse the input integers correctly and that we have to debug that as well?

  • + 0 comments

    Branded merchandise tied to "Gridland Metro" is gaining attention as the game continues to captivate its players. Fans can find a range of collectible items, from stylish apparel to limited-edition accessories, all designed to enhance the connection with the unique gameplay experience. Whether you’re a strategy enthusiast or just discovering the game’s charm, these branded products offer a way to express your fandom and bring a piece of Gridland Metro into everyday life.