INZM2ENESVXDIUSQCF7NKURPEKBXMMNWT6E2XS34OGEBDECQFWUAC
7R5IKOBGJYGMA6QA62SX2HV3I273YSVENO6ZH44B5WMOS7CBKWLQC
QBPUYYX77BA2WDPCGZCIYQ3NCSHWRZA7YALZEFODQASRT2QBDNDAC
37QWQTZRMBJPETT5SN2KZI4FJZO7QR3WI5PPX5EYBTHDXP4SJ7SAC
OGGHZPIWOOEEAQBJZ63D5U5V3ZZ5IJFNIWJS733HHZ4NECBPPGXAC
var g = try parseInput();
const g = try parseInput();
fn dijkstra(grid: *Grid, dist: *Distance, queue: *Queue) !?RetType {
fn dijkstra(grid: *const Grid, dist: *Distance, queue: *Queue) !?RetType {
pub fn getBasin(self: @This(), seen: *std.AutoHashMap(Point, void), p: Point) anyerror!RetType { if (seen.contains(p)) {
pub fn getBasin(self: @This(), seen: *std.AutoHashMap(Point, void), p: Point) anyerror!RetType {
if (seen.contains(p)) {
seen: std.AutoHashMap(Point, void), pub fn getBasin(self: *@This(), p: Point) anyerror!RetType { if (self.seen.contains(p)) {
seen: std.AutoHashMap(Point, void),
pub fn getBasin(self: *@This(), p: Point) anyerror!RetType {
if (self.seen.contains(p)) {
try seen.put(p, {});
try self.seen.put(p, {});
var ret: RetType = 0; ret += 1;
var ret: RetType = 0;
ret += 1;
var ret: RetType = 1;
ret += try self.getBasin(seen, Point{ .row = @intCast(usize, diffrow), .col = @intCast(usize, diffcol) });
ret += try self.getBasin(Point{ .row = @intCast(usize, diffrow), .col = @intCast(usize, diffcol) });
const grid: Grid = .{
var grid: Grid = .{
.seen = undefined,
var seen = std.AutoHashMap(Point, void).init(allocator.?); defer seen.deinit();
var seen = std.AutoHashMap(Point, void).init(allocator.?);
defer seen.deinit();
grid.seen = std.AutoHashMap(Point, void).init(allocator.?); defer grid.seen.deinit();
grid.seen = std.AutoHashMap(Point, void).init(allocator.?);
defer grid.seen.deinit();
const basin = try grid.getBasin(&seen, Point{ .row = row, .col = col });
const basin = try grid.getBasin(Point{ .row = row, .col = col });
seen.clearRetainingCapacity();
grid.seen.clearRetainingCapacity();