Algorithm Designex06m1_massrelay
Mass Relay
7b0db5a4-30a8-4195-9f59-7bb1f37d22b5.cppC++
1// Loading code...Selected Submission
30 / 100
1.6s
4080 KB
Binary SearchBFS/DFSGraph
Time Comp.
O(M log M + Q * (M + N))
Space Comp.
O(M + N)
Readability
7/10
"The code uses a binary search to find the maximum edge weight such that the graph has at most 'd' connected components. The `countComponents` function performs a BFS to determine the number of connected components for a given maximum edge weight, which is a graph traversal problem."
History
| Attempt | Points | Time ↓ |
|---|---|---|
| Try #4 | 30 | 4/1/2025 |
| Try #3 | 0 | 4/1/2025 |
| Try #2 | 100 | 4/1/2025 |
| Try #1 | 0 | 4/1/2025 |