Here is my analysis of the solution:
- There are edges per query.
- Each edge takes to process. There are added every query and O(q) queries, so we have edges, meaning each edge is to process.
- Finally, there are O(q) queries.
This gives us overall. However, the editorial does not have the term and simply has . How did they get rid of the term in the analysis? Did I do something wrong here?