File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change
1
+ from sys import stdin
2
+
3
+ lines = stdin .read ().strip ().split ("\n " )
4
+ p = 0
5
+ repeat = [1 ] * len (lines )
6
+ for i , line in enumerate (lines ):
7
+ right , left = line .split (":" )[1 ].split ("|" )
8
+ shared = len (set (right .split ()) & set (left .split ()))
9
+ if shared :
10
+ p += 2 ** (shared - 1 )
11
+ for j in range (i + 1 , min (i + 1 + shared , len (lines ))):
12
+ repeat [j ] += repeat [i ]
13
+ print (p , sum (repeat ), sep = '\n ' )
Original file line number Diff line number Diff line change 4
4
5
5
<!-- AOC TILES BEGIN -->
6
6
<h1 align =" center " >
7
- 2023 - 6 ⭐
7
+ 2023 - 8 ⭐
8
8
</h1 >
9
9
<a href =" 2023/01/01.py " >
10
10
<img src =" Media/2023/01.png " width =" 161px " >
15
15
<a href =" 2023/03/03.py " >
16
16
<img src =" Media/2023/03.png " width =" 161px " >
17
17
</a >
18
+ <a href =" 2023/04/04.py " >
19
+ <img src =" Media/2023/04.png " width =" 161px " >
20
+ </a >
18
21
<h1 align =" center " >
19
22
2022 - 50 ⭐
20
23
</h1 >
You can’t perform that action at this time.
0 commit comments