This commit is contained in:
Arthur
2024-06-07 03:12:49 +02:00
parent 32e3dbdf4f
commit f39dceb721
21 changed files with 2938 additions and 6 deletions

10
d11/exemple1.txt Normal file
View File

@@ -0,0 +1,10 @@
...#......
.......#..
#.........
..........
......#...
.#........
.........#
..........
.......#..
#...#.....

140
d11/input.txt Normal file
View File

@@ -0,0 +1,140 @@
..#..........#................................................#.............................................................................
...................................#............................................#..........................#............................#...
......................................................................#.............................#.......................................
........#...................................#..................................................................................#............
.................#.........#..........#...............#........................................#.................#..........................
.................................#..............#...................................#.......................................................
#.........................................................................#...............#............................#....................
.......................#........................................................#...........................................................
.......#.........................................................#................................#.................................#.......
..................#...............................#...........................................................#.............................
...........#.................................#..............#................................................................#...........#..
..........................#........#........................................................................................................
.#..................................................................#................#.................#....................................
......................#.........................#.....................................................................................#.....
..........................................#....................#..............#....................#........................................
.........................................................................................#.........................#.....#..................
..............#.............................................................................................................................
..........................................................................................................#........................#........
.....#.........................#.............#....................#.......#........#........................................#...............
..........................#...........#...............................................................#.....................................
...................#...........................................................................#................#...........................
#............#........................................#................................................................................#....
......................................................................................................................#.........#...........
........................................#...................................................................................................
...#............#........#...........................................................#......................................................
.............................................#..............................................................................................
............#.......#..........................................................................#..................#.....#...................
................................................................................#.........................#....................#.....#......
.................................................................#..........................................................................
..........................#...............#.................................................#.................#.............................
#.........#...........................................#............................................#........................................
.....................#................#................................#....................................................................
.....................................................................................#.....................#............#...................
............................................................................................................................................
.............................#..........................................................................................................#...
.................#..................#......#......#............................#......................#..........#...........#..............
.......#.................#...........................................#......................................................................
......................................................................................#.....................................................
...#....................................................#......#..................................#.........................................
............#........#.........#..............#.........................#....................................#..............................
.......................................................................................................#................#.....#.............
..............................................................................................#.............................................
....................................................................................#..............................#......................#.
#.............#.........#..................#.............................................#...........................................#......
.............................#......#...........#.........#...................#.............................................................
.......#...........................................................................................#.....#..................................
...................#........................................................................................................#.....#.........
....................................................#..................#....................................................................
.................................#............................#.............................................................................
.......................#.................................#...........................................................................#......
........................................#..........................................#............#...............#...........................
.........................................................................................#..................................................
.............................................#......................#.......................................................................
..........................#...........................................................................#.........................#...........
............................................................................................................................................
...........#....................................................................#......#....................................................
....................................................................................................................#......................#
...............#........................#....................................................#..............................................
.....#.........................................#................#...........................................................................
.......................#.............................................#................................#..................#.........#........
#.........#.........................................#..........................#........#.......................#...........................
..............................#.............................................................................................................
.....................................#....................................................................#.....................#...........
..............................................................#.............#...............................................................
..#......................................................................................................................................#..
.................#.........#........................................................#....................................#..................
................................#.......................#.......................................#...........................................
..........................................#.....#...................................................................#.......................
......#......#.........................................................................................#......................#.............
......................................#..............#......................................................................................
..................#...........#.................................#...........................................................................
..#.......#............................................................................#...................................................#
......................#..................................#..............#...................................................................
..........................................................................................................................#.................
.................................#.........#....................................................#...........................................
............................................................................................................................................
....................#...............................................................................#.......................................
.#...................................#..........#...........................................................................................
.......#..............................................................#.................................#...................................
.............................#...........#.....................#.................................#.............................#............
.......................#....................................................................#...................#......................#....
.............#.....................#.................#..........................#....................................#......................
...........................................................................#............#...........#..............................#........
..........................................................................................................................................#.
.#..............................#...........................................................................................................
.............................................#............#...............................................#.................................
...............#.......#..........................#.................#.......................#...........................#...................
...............................................................................#.................................................#..........
.........#..............................#..............................................................#......#.............................
............................................................................................................................................
................................................#........................................#..................................................
.........................................................................#......................#.....................................#.....
...........#......#..........#......................#......................................................................#................
..........................................................#...................#.....#.......#.....................#.........................
......................................#.....................................................................................................
........#................................................................................................................................#..
......................#........................#................#....................................#........#.............................
..#.......................................#.......................................................................................#.........
..............#.............................................................................................................................
.........................................................................#..................................................................
.........................#..........#........#........................................#.....................................................
.....#..................................................#..................................................................................#
..............................#................................#..............#..............#................#............#................
........................................................................................................#.............#.........#...........
.#.............#.......................................................#....................................................................
.......................................#....................................................................................................
.......................#..........................#.......#.................................................................................
.......#........................................................................#...........................................................
............................#........................................#................................................................#.....
..........................................#..........#........................................................#.............................
..............#..........................................................................#.....#..................................#.........
#...........................................................................................................................................
..................................#................................................................#........................#...............
..................................................................#.........................#...............#..........................#....
.......................................#...................................#..........#............................#........................
..................#.....#.....#.............#..........................................................#....................................
...................................................................................................................................#........
......................................................#.......................................................#.............................
...........#...............#...................#...............#....................#...............#.................#.....................
.........................................#......................................................................................#...........
...............................#.........................................................#......#.................#.....................#...
..#.................................................#....................................................#...............#..................
........#.............................#.....................................................................................................
..............#.........#................................................#..................................................................
..........................................#.....................................#....................#.......................#..............
............................................................................................................................................
................................#...............#..........................................................#.....#...............#..........
..#.......#.................................................................................................................................
........................................................................#...............................................#...................
............................#.................................#.........................#..........#........................................
....................#.............................#.........................................................................#...............
........................................................#....................................#..........#......#............................
........#...................................................................................................................................
.........................................................................#..........#.......................................................
............#......................#............#.................................................................#.....................#...
.............................#.....................................................................#........................................
........................................................................................................................#...................
.......#.........#...........................................................................#.........#......#.............................
........................#.............................#..........#...................................................................#......
...#.................................#........#................................#.....#.......................................#..............

59
d11/run1_p.py Normal file
View File

@@ -0,0 +1,59 @@
import sys
L = sys.stdin.read().splitlines()
gal = []
for line, P in enumerate(L):
for col, p in enumerate(P):
if p != ".":
gal.append([line, col])
print(gal)
# Expansion
lines = [l[0] for l in gal]
cols = [l[1] for l in gal]
#print(lines)
lines_empty = []
for line in range(0, len(L)):
if lines.count(line) == 0:
lines_empty.append(line)
print(lines_empty)
for line in reversed(lines_empty):
for g in gal:
if g[0] > line:
g[0] +=1
print(gal)
cols_empty = []
for col in range(0, len(L[0])):
if cols.count(col) == 0:
cols_empty.append(col)
print(cols_empty)
for col in reversed(cols_empty):
for g in gal:
if g[1] > col:
g[1] +=1
print(gal)
nb = 0
S=0
for s in range(0, len(gal)):
print("s ", s)
for n in range(1, len(gal)-s):
nb+=1
print(gal[s], gal[s+n])
l = (abs(gal[s+n][0] - gal[s][0])) + abs((gal[s+n][1] - gal[s][1]))
print(l)
S+=l
print(nb, S)