Procházet zdrojové kódy

Optimise day 14.

No point checking for connected nodes in +x or +y directions,
as we haven't processed them yet.
master
Chris Smith před 6 roky
rodič
revize
d9750988e3
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1
    1
      14.py

+ 1
- 1
14.py Zobrazit soubor

9
     for y, row in enumerate(grid):
9
     for y, row in enumerate(grid):
10
         for x, cell in enumerate(row):
10
         for x, cell in enumerate(row):
11
             if cell == '1':
11
             if cell == '1':
12
-                add_connected_components(regions, [(x-1, y), (x, y-1), (x+1, y), (x, y+1)], {(x, y)})
12
+                add_connected_components(regions, [(x-1, y), (x, y-1)], {(x, y)})
13
     print(f'Part two: {len(regions)}')
13
     print(f'Part two: {len(regions)}')

Načítá se…
Zrušit
Uložit