# THE POND-WIDE BLACKOUT

WEEKLY QUACK CHALLENGE! · challenge 7 · hard · 5 guesses

> Grid Chief Merganser clutches the grid map, feathers on end. "The whole network went dark last night, Duckbert. Multiple ponds lost power — but one sat stone cold for longer than any other, unbroken, hour after hour. Some ponds flickered in and out more times than I can count. Don't be fooled by the total dark count. I need the pond that suffered the single longest continuous blackout. Find it."

## Task

A pond’s total load each hour is the combined megawatts of all its meters, and the pond is blacked out in any hour its total load is 1.0 MW or less. Readings are hourly with no gaps. Return the name of the pond with the longest unbroken run of consecutive blackout hours; on a tie, the alphabetically first. You will be working with the `power_readings`, `meters`, and `ponds` tables.

## Tables

### `power_readings` (288 rows)

| column | type |
| --- | --- |
| meter_id | INTEGER |
| ts | TIMESTAMP |
| megawatts | DECIMAL(8,2) |

### `meters` (12 rows)

| column | type |
| --- | --- |
| meter_id | INTEGER |
| pond_id | INTEGER |

### `ponds` (4 rows)

| column | type |
| --- | --- |
| pond_id | INTEGER |
| name | VARCHAR |

## Data

The tables live in a DuckDB database: https://dbquacks.com/data/databases/weekly_202633_07_blackout.duckdb

To query it outside the browser, attach it read-only:

```sql
ATTACH 'https://dbquacks.com/data/databases/weekly_202633_07_blackout.duckdb' AS db (READ_ONLY);
USE db;
```

Play it in the browser: https://dbquacks.com/challenges/weekly/7

## Answer

The expected answer is not published. Submit on the page to have it checked.
