Compare commits

...

2 Commits

Author SHA1 Message Date
setop e51de70c36 day 8, compare two approaches for part 1 2022-12-09 00:06:28 +01:00
setop 82b23cf1b4 some stats, to be completed end of month 2022-12-09 00:05:35 +01:00
3 changed files with 145 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import sys
L = list(list(map(int,s)) for s in sys.stdin.read().splitlines())
W = len(L[0]) ; H = len(L)
N = 0
Q = 0
for i in range(H):
for j in range(W):
v = L[i][j]
@ -14,4 +15,5 @@ for i in range(H):
# look down
d = all(L[k][j]<v for k in range(i+1,H))
N += (r|l|u|d)
print(N, W*H)
Q += W + H
print(N, W*H*(W+H), Q)

23
d08/part1b.py Normal file
View File

@ -0,0 +1,23 @@
import sys
L = list(list(map(int,s)) for s in sys.stdin.read().splitlines())
W = len(L[0]) ; H = len(L)
size = W * H
Q = 0
def check(rows, cols):
global Q
h = -1
for r in rows:
for c in cols:
if L[r][c] > h:
V[r * W + c] = True
h = L[r][c]
Q += 1
V = [False for _ in range(size)]
for r in range(H):
check([r], range(W))
check([r], range(W-1, -1, -1))
for c in range(W):
check(range(H), [c])
check(range(H-1, -1, -1), [c])
print(sum(V), 2*(H*W+W*H), Q)

118
stats.slk Normal file
View File

@ -0,0 +1,118 @@
ID;PCALCOOO32
C;X1;Y1;K217872
C;X2;Y1;K28530
C;X3;Y1;K246402;EA1+B1
C;X5;Y1;K204702
C;X6;Y1;K8364
C;X7;Y1;K213066;EE1+F1
C;X1;Y2;K194482
C;X2;Y2;K8024
C;X3;Y2;K202506;EA2+B2
C;X5;Y2;K169839
C;X6;Y2;K7521
C;X7;Y2;K177360;EE2+F2
C;X1;Y3;K137678
C;X2;Y3;K38713
C;X3;Y3;K176391;EA3+B3
C;X5;Y3;K143978
C;X6;Y3;K7051
C;X7;Y3;K151029;EE3+F3
C;X1;Y4;K106585
C;X2;Y4;K6568
C;X3;Y4;K113153;EA4+B4
C;X5;Y4;K131242
C;X6;Y4;K2170
C;X7;Y4;K133412;EE4+F4
C;X1;Y5;K93739
C;X2;Y5;K4820
C;X3;Y5;K98559;EA5+B5
C;X5;Y5;K109082
C;X6;Y5;K2026
C;X7;Y5;K111108;EE5+F5
C;X1;Y6;K92062
C;X2;Y6;K7157
C;X3;Y6;K99219;EA6+B6
C;X5;Y6;K105272
C;X6;Y6;K966
C;X7;Y6;K106238;EE6+F6
C;X1;Y7;K90753
C;X2;Y7;K2480
C;X3;Y7;K93233;EA7+B7
C;X5;Y7;K65714
C;X6;Y7;K1988
C;X7;Y7;K67702;EE7+F7
C;X1;Y8;K70599
C;X2;Y8;K12569
C;X3;Y8;K83168;EA8+B8
C;X5;Y8;K24458
C;X6;Y8;K6391
C;X7;Y8;K30849;EE8+F8
C;X1;Y9;K65999
C;X2;Y9;K10759
C;X3;Y9;K76758;EA9+B9
C;X7;Y9;K0;EE9+F9
C;X1;Y10;K67262
C;X2;Y10;K1897
C;X3;Y10;K69159;EA10+B10
C;X7;Y10;K0;EE10+F10
C;X1;Y11;K60349
C;X2;Y11;K338
C;X3;Y11;K60687;EA11+B11
C;X7;Y11;K0;EE11+F11
C;X1;Y12;K50948
C;X2;Y12;K2102
C;X3;Y12;K53050;EA12+B12
C;X7;Y12;K0;EE12+F12
C;X1;Y13;K53038
C;X2;Y13;K929
C;X3;Y13;K53967;EA13+B13
C;X7;Y13;K0;EE13+F13
C;X1;Y14;K47059
C;X2;Y14;K7170
C;X3;Y14;K54229;EA14+B14
C;X7;Y14;K0;EE14+F14
C;X1;Y15;K39432
C;X2;Y15;K3564
C;X3;Y15;K42996;EA15+B15
C;X7;Y15;K0;EE15+F15
C;X1;Y16;K33597
C;X2;Y16;K1709
C;X3;Y16;K35306;EA16+B16
C;X7;Y16;K0;EE16+F16
C;X1;Y17;K33586
C;X2;Y17;K1511
C;X3;Y17;K35097;EA17+B17
C;X7;Y17;K0;EE17+F17
C;X1;Y18;K25687
C;X2;Y18;K183
C;X3;Y18;K25870;EA18+B18
C;X7;Y18;K0;EE18+F18
C;X1;Y19;K17189
C;X2;Y19;K258
C;X3;Y19;K17447;EA19+B19
C;X7;Y19;K0;EE19+F19
C;X1;Y20;K23207
C;X2;Y20;K377
C;X3;Y20;K23584;EA20+B20
C;X7;Y20;K0;EE20+F20
C;X1;Y21;K20211
C;X2;Y21;K6492
C;X3;Y21;K26703;EA21+B21
C;X7;Y21;K0;EE21+F21
C;X1;Y22;K16039
C;X2;Y22;K6058
C;X3;Y22;K22097;EA22+B22
C;X7;Y22;K0;EE22+F22
C;X1;Y23;K13576
C;X2;Y23;K2189
C;X3;Y23;K15765;EA23+B23
C;X7;Y23;K0;EE23+F23
C;X1;Y24;K13103
C;X2;Y24;K132
C;X3;Y24;K13235;EA24+B24
C;X7;Y24;K0;EE24+F24
C;X1;Y25;K11320
C;X2;Y25;K5992
C;X3;Y25;K17312;EA25+B25
C;X7;Y25;K0;EE25+F25
E