1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
//! # Day 22: Grid Computing
//!
//! You gain access to a massive storage cluster arranged in a grid; each storage node is only
//! connected to the four nodes directly adjacent to it (three if the node is on an edge, two if
//! it's in a corner).
//!
//! You can directly access data **only** on node `/dev/grid/node-x0-y0`, but you can perform some
//! limited actions on the other nodes:
//!
//! - You can get the disk usage of all nodes (via [`df`]). The result of doing this is in your
//! puzzle input.
//! - You can instruct a node to **move** (not copy) **all** of its data to an adjacent node (if the
//! destination node has enough space to receive the data). The sending node is left empty after
//! this operation.
//!
//! Nodes are named by their position: the node named `node-x10-y10` is adjacent to nodes
//! `node-x9-y10`, `node-x11-y10`, `node-x10-y9`, and `node-x10-y11`.
//!
//! Before you begin, you need to understand the arrangement of data on these nodes. Even though you
//! can only move data between directly connected nodes, you're going to need to rearrange a lot of
//! the data to get access to the data you need. Therefore, you need to work out how you might be
//! able to shift data around.
//!
//! To do this, you'd like to count the number of **viable pairs** of nodes. A viable pair is any
//! two nodes (A,B), **regardless of whether they are directly connected**, such that:
//!
//! - Node A is **not** empty (its `Used` is not zero).
//! - Nodes A and B are **not the same** node.
//! - The data on node A (its `Used`) **would fit** on node B (its `Avail`).
//!
//! **How many viable pairs** of nodes are there?
//!
//! [`df`]: https://en.wikipedia.org/wiki/Df_(Unix)#Example
use anyhow::Result;
pub const INPUT: &str = include_str!("d22.txt");
pub fn solve_part_one(input: &str) -> Result<i64> {
Ok(0)
}
pub fn solve_part_two(input: &str) -> Result<i64> {
Ok(0)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part_one() {}
#[test]
fn part_two() {}
}