Graph Theory37 sections · 1633 units
Open in Course

CSES 1195 Flight Discount - Problem Statement

(CSES - State-space Dijkstra)

You have a directed graph with N cities and M flights. Each flight has a cost. You get exactly one 5050% discount coupon to use on any single flight.

Find the minimum cost to travel between city 11 and city N.

Constraints: N105N \leq 10^5, M ≤ 2×1052 \times 10^5. You must decide where to use the coupon optimally. The challenge is that you cannot just pick the most expensive edge. The best discount depends on which path you take, so you need to consider all options simultaneously.