Name | Language | Tokens Sum | Tokens Part 1 | Tokens Part 2 | Last change | |
---|---|---|---|---|---|---|
1 | CornerMercury | Python | 211 | 100 | 111 | 40 days ago |
2 | dbasden | Python | 320 | 151 | 169 | 39 days ago |
import
sys
from
collections
import
defaultdict
antennas
=
defaultdict
(
list
)
# { antennatype: [(i,j), ...], ... }
def
getlocs
(
)
:
for
type
,
locs
in
antennas
.
items
(
)
:
for
i
,
a
in
enumerate
(
locs
)
:
for
b
in
locs
[
i
+
1
:
]
:
for
h
in
range
(
1
,
256
)
:
yield
b
+
h
*
(
a
-
b
)
yield
a
+
h
*
(
b
-
a
)
height
=
0
for
i
,
l
in
enumerate
(
sys
.
stdin
)
:
height
+=
1
for
j
,
c
in
enumerate
(
l
:=
l
.
strip
(
)
)
:
if
c
!=
'
.
'
:
antennas
[
c
]
.
append
(
complex
(
i
,
j
)
)
print
(
sum
(
1
for
loc
in
set
(
getlocs
(
)
)
if
0
<=
loc
.
real
<
height
and
0
<=
loc
.
imag
<
len
(
l
)
)
)