8/21-8/28 Slides
A - Primary Task
B - Seating in a Bus
C - Numeric String
Template
D - Right Left Wrong
E - Photoshoot for Gorillas
F - Color Rows and Columns
We do knapsack dp on the minimal number of operations with the state [first i rectangles][getting j points].
G - Call During
the Journey
We Dijkstra from “n” to find the latest time you are allowed to leave the i-th node. Before adding a state involving using a bus to the priority queue, make sure we are allowed to use the bus. Before adding a state involving walking to the priority queue, make sure it is not a better decision to simply wait and use a bus. Try not to TLE on test case 17 :(
H - Ksyusha and the Loaded Set
Maintain a segment tree of size MAX_X throughout all test cases. Maintain vals below
Answer +/- queries by setting the index to true or false in the segment tree
For ? queries, binary search on the first index such that [0, idx] has a continuous string
of 0s of length k. If no such values exist, print last_true_idx + 1, else print idx - x + 1
At the end, reset the segment tree by setting all values back to false