diff options
| -rw-r--r-- | 19/cpp/01-1.cpp (renamed from solutions/cpp/01-1.cpp) | 0 | ||||
| -rw-r--r-- | 19/cpp/01-2.cpp (renamed from solutions/cpp/01-2.cpp) | 0 | ||||
| -rw-r--r-- | 19/cpp/02-1.cpp (renamed from solutions/cpp/02-1.cpp) | 0 | ||||
| -rw-r--r-- | 19/cpp/02-2.cpp (renamed from solutions/cpp/02-2.cpp) | 0 | ||||
| -rw-r--r-- | 19/input/01 (renamed from solutions/input/01) | 0 | ||||
| -rw-r--r-- | 19/input/02 (renamed from solutions/input/02) | 0 | ||||
| -rw-r--r-- | 19/input/03 (renamed from solutions/input/03) | 0 | ||||
| -rw-r--r-- | 19/input/04 (renamed from solutions/input/04) | 0 | ||||
| -rw-r--r-- | 19/input/05 (renamed from solutions/input/05) | 0 | ||||
| -rw-r--r-- | 19/input/06 (renamed from solutions/input/06) | 0 | ||||
| -rw-r--r-- | 19/input/07 (renamed from solutions/input/07) | 0 | ||||
| -rw-r--r-- | 19/input/08 (renamed from solutions/input/08) | 0 | ||||
| -rw-r--r-- | 19/input/09 (renamed from solutions/input/09) | 0 | ||||
| -rw-r--r-- | 19/input/10 (renamed from solutions/input/10) | 0 | ||||
| -rw-r--r-- | 19/input/11 (renamed from solutions/input/11) | 0 | ||||
| -rw-r--r-- | 19/input/12 (renamed from solutions/input/12) | 0 | ||||
| -rw-r--r-- | 19/input/13 (renamed from solutions/input/13) | 0 | ||||
| -rw-r--r-- | 19/input/14 (renamed from solutions/input/14) | 0 | ||||
| -rw-r--r-- | 19/input/15 | 1 | ||||
| -rw-r--r-- | 19/input/15-ed (renamed from solutions/input/15-ed) | 0 | ||||
| -rw-r--r-- | 19/input/15-eskil (renamed from solutions/input/15-eskil) | 0 | ||||
| -rw-r--r-- | 19/input/16 (renamed from solutions/input/16) | 0 | ||||
| -rw-r--r-- | 19/input/17 (renamed from solutions/input/17) | 0 | ||||
| -rw-r--r-- | 19/py/d01.py (renamed from solutions/py/d01.py) | 0 | ||||
| -rw-r--r-- | 19/py/d02.py (renamed from solutions/py/d02.py) | 0 | ||||
| -rw-r--r-- | 19/py/d03.py (renamed from solutions/py/d03.py) | 7 | ||||
| -rw-r--r-- | 19/py/d04.py (renamed from solutions/py/d04.py) | 0 | ||||
| -rw-r--r-- | 19/py/d05.py (renamed from solutions/py/d05.py) | 0 | ||||
| -rw-r--r-- | 19/py/d06.py (renamed from solutions/py/d06.py) | 0 | ||||
| -rw-r--r-- | 19/py/d07.py (renamed from solutions/py/d07.py) | 0 | ||||
| -rw-r--r-- | 19/py/d08.py (renamed from solutions/py/d08.py) | 0 | ||||
| -rw-r--r-- | 19/py/d09.py (renamed from solutions/py/d09.py) | 0 | ||||
| -rw-r--r-- | 19/py/d10.py (renamed from solutions/py/d10.py) | 0 | ||||
| -rw-r--r-- | 19/py/d11.py (renamed from solutions/py/d11.py) | 0 | ||||
| -rw-r--r-- | 19/py/d12.py (renamed from solutions/py/d12.py) | 4 | ||||
| -rw-r--r-- | 19/py/d13.py (renamed from solutions/py/d13.py) | 0 | ||||
| -rw-r--r-- | 19/py/d14.py (renamed from solutions/py/d14.py) | 0 | ||||
| -rw-r--r-- | 19/py/d15.py (renamed from solutions/py/d15.py) | 0 | ||||
| -rw-r--r-- | 19/py/d16.py (renamed from solutions/py/d16.py) | 0 | ||||
| -rw-r--r-- | 19/py/d17.py (renamed from solutions/py/d17.py) | 24 | ||||
| -rw-r--r-- | 19/py/intcode.py (renamed from solutions/py/intcode.py) | 41 | ||||
| -rw-r--r-- | 19/py/main.py | 52 | ||||
| -rw-r--r-- | solutions/cpp/02.in | 1 | ||||
| -rw-r--r-- | solutions/input/15 | 1 | ||||
| -rw-r--r-- | solutions/py/main.py | 52 |
45 files changed, 89 insertions, 94 deletions
diff --git a/solutions/cpp/01-1.cpp b/19/cpp/01-1.cpp index fcb593a..fcb593a 100644 --- a/solutions/cpp/01-1.cpp +++ b/19/cpp/01-1.cpp diff --git a/solutions/cpp/01-2.cpp b/19/cpp/01-2.cpp index 7ce1a82..7ce1a82 100644 --- a/solutions/cpp/01-2.cpp +++ b/19/cpp/01-2.cpp diff --git a/solutions/cpp/02-1.cpp b/19/cpp/02-1.cpp index b6db056..b6db056 100644 --- a/solutions/cpp/02-1.cpp +++ b/19/cpp/02-1.cpp diff --git a/solutions/cpp/02-2.cpp b/19/cpp/02-2.cpp index aab95a8..aab95a8 100644 --- a/solutions/cpp/02-2.cpp +++ b/19/cpp/02-2.cpp diff --git a/solutions/input/01 b/19/input/01 index bcf9d47..bcf9d47 100644 --- a/solutions/input/01 +++ b/19/input/01 diff --git a/solutions/input/02 b/19/input/02 index bcebbfa..bcebbfa 100644 --- a/solutions/input/02 +++ b/19/input/02 diff --git a/solutions/input/03 b/19/input/03 index f9771e4..f9771e4 100644 --- a/solutions/input/03 +++ b/19/input/03 diff --git a/solutions/input/04 b/19/input/04 index e69de29..e69de29 100644 --- a/solutions/input/04 +++ b/19/input/04 diff --git a/solutions/input/05 b/19/input/05 index fe477a1..fe477a1 100644 --- a/solutions/input/05 +++ b/19/input/05 diff --git a/solutions/input/06 b/19/input/06 index b433fcd..b433fcd 100644 --- a/solutions/input/06 +++ b/19/input/06 diff --git a/solutions/input/07 b/19/input/07 index 016f35f..016f35f 100644 --- a/solutions/input/07 +++ b/19/input/07 diff --git a/solutions/input/08 b/19/input/08 index 29390a5..29390a5 100644 --- a/solutions/input/08 +++ b/19/input/08 diff --git a/solutions/input/09 b/19/input/09 index 27b47ee..27b47ee 100644 --- a/solutions/input/09 +++ b/19/input/09 diff --git a/solutions/input/10 b/19/input/10 index 8944c53..8944c53 100644 --- a/solutions/input/10 +++ b/19/input/10 diff --git a/solutions/input/11 b/19/input/11 index 6ecf042..6ecf042 100644 --- a/solutions/input/11 +++ b/19/input/11 diff --git a/solutions/input/12 b/19/input/12 index 550a98c..550a98c 100644 --- a/solutions/input/12 +++ b/19/input/12 diff --git a/solutions/input/13 b/19/input/13 index def383f..def383f 100644 --- a/solutions/input/13 +++ b/19/input/13 diff --git a/solutions/input/14 b/19/input/14 index c9b5f41..c9b5f41 100644 --- a/solutions/input/14 +++ b/19/input/14 diff --git a/19/input/15 b/19/input/15 new file mode 100644 index 0000000..8058324 --- /dev/null +++ b/19/input/15 @@ -0,0 +1 @@ +3,1033,1008,1033,1,1032,1005,1032,31,1008,1033,2,1032,1005,1032,58,1008,1033,3,1032,1005,1032,81,1008,1033,4,1032,1005,1032,104,99,101,0,1034,1039,1001,1036,0,1041,1001,1035,-1,1040,1008,1038,0,1043,102,-1,1043,1032,1,1037,1032,1042,1105,1,124,101,0,1034,1039,101,0,1036,1041,1001,1035,1,1040,1008,1038,0,1043,1,1037,1038,1042,1106,0,124,1001,1034,-1,1039,1008,1036,0,1041,1001,1035,0,1040,1001,1038,0,1043,1002,1037,1,1042,1105,1,124,1001,1034,1,1039,1008,1036,0,1041,102,1,1035,1040,101,0,1038,1043,1002,1037,1,1042,1006,1039,217,1006,1040,217,1008,1039,40,1032,1005,1032,217,1008,1040,40,1032,1005,1032,217,1008,1039,1,1032,1006,1032,165,1008,1040,33,1032,1006,1032,165,1101,0,2,1044,1106,0,224,2,1041,1043,1032,1006,1032,179,1101,1,0,1044,1106,0,224,1,1041,043,1032,1006,1032,217,1,1042,1043,1032,1001,1032,-1,1032,1002,1032,39,1032,1,1032,1039,1032,101,-1,1032,1032,101,252,1032,211,1007,0,43,1044,1105,1,224,1101,0,0,1044,1106,0,224,1006,1044,247,1002,1039,1,1034,1002,1040,1,1035,102,1,1041,1036,1001,1043,0,1038,101,0,1042,1037,4,1044,1105,1,0,13,30,60,64,5,28,36,24,67,12,1,67,32,39,14,78,29,17,38,88,79,9,62,25,15,18,88,25,7,81,38,41,10,69,86,32,11,33,1,10,22,84,14,92,48,79,10,3,62,33,61,13,93,78,20,63,68,17,80,34,12,8,23,61,90,51,17,84,37,46,64,25,3,73,19,45,99,41,62,21,77,8,17,89,9,13,84,75,85,14,53,60,6,29,76,63,14,23,63,61,93,72,17,41,28,94,5,3,19,47,57,55,14,34,38,79,85,40,13,22,99,67,72,15,62,15,6,63,3,90,2,87,20,84,15,50,70,27,18,78,21,70,48,52,2,99,92,55,3,46,41,93,99,88,13,39,4,45,71,3,96,1,91,59,31,53,23,25,82,32,50,16,60,38,78,34,59,30,15,51,92,3,22,26,62,60,37,42,74,28,21,76,7,24,70,18,40,11,81,41,9,73,62,12,66,81,9,3,74,62,11,6,56,16,34,20,78,79,1,97,17,39,87,15,12,77,94,28,22,66,45,59,39,2,6,52,6,72,49,17,92,15,86,18,92,79,67,20,22,72,10,72,3,52,26,77,78,41,97,36,59,88,24,57,12,38,90,53,14,38,67,2,36,44,93,99,10,41,49,3,16,7,63,32,11,15,81,12,91,39,62,19,83,6,91,28,19,80,38,23,63,31,71,14,58,8,21,71,21,21,81,38,26,32,29,82,52,28,72,54,97,41,65,96,75,1,48,28,80,66,25,47,49,29,87,51,12,50,70,36,60,81,29,77,76,55,25,40,45,83,91,26,72,99,12,47,11,20,27,52,9,98,17,99,27,37,62,25,3,15,73,66,22,5,85,5,20,98,20,38,62,78,21,16,59,28,98,38,31,2,40,46,87,14,48,33,80,48,36,27,56,21,1,50,83,3,61,92,20,52,16,50,10,86,9,98,39,56,25,50,42,39,91,81,56,25,70,44,24,15,99,4,20,55,12,98,27,65,20,77,97,76,36,42,87,6,11,79,65,16,65,44,13,90,13,48,79,13,95,60,19,55,24,66,4,53,11,23,68,14,97,53,45,14,16,93,18,29,83,5,6,77,19,70,97,34,20,70,52,11,74,14,72,10,36,44,33,45,19,38,36,77,5,37,51,1,55,17,2,48,23,18,2,34,90,97,24,30,51,66,33,70,51,37,31,51,37,65,55,18,8,66,4,65,62,26,93,29,88,3,75,73,24,23,67,1,13,68,7,36,87,62,48,1,31,45,28,62,86,24,98,1,59,49,37,26,62,36,44,66,18,17,97,92,40,36,65,80,84,5,84,6,79,87,36,31,96,15,71,96,2,72,11,81,95,94,41,54,31,58,25,74,24,51,81,38,32,73,22,96,40,62,22,59,74,39,25,86,2,55,20,61,40,37,88,69,1,60,42,18,31,54,13,27,19,93,34,41,99,33,89,20,16,52,84,32,94,31,6,61,25,1,61,1,38,78,87,39,31,39,26,68,42,36,2,94,66,2,67,30,80,2,95,65,40,54,50,33,11,23,97,89,1,31,56,9,35,49,92,55,23,84,48,91,20,7,72,25,55,3,85,3,16,40,90,22,99,44,38,86,98,11,76,26,76,13,82,80,24,93,4,15,64,95,58,15,85,25,57,29,66,3,66,19,98,57,24,44,59,35,76,48,31,92,33,94,68,56,41,45,15,46,5,68,15,65,34,73,49,68,17,78,28,80,24,59,26,74,21,52,1,94,5,61,41,88,37,56,1,49,0,0,21,21,1,10,1,0,0,0,0,0,0 diff --git a/solutions/input/15-ed b/19/input/15-ed index da43b33..da43b33 100644 --- a/solutions/input/15-ed +++ b/19/input/15-ed diff --git a/solutions/input/15-eskil b/19/input/15-eskil index 834f639..834f639 100644 --- a/solutions/input/15-eskil +++ b/19/input/15-eskil diff --git a/solutions/input/16 b/19/input/16 index a424590..a424590 100644 --- a/solutions/input/16 +++ b/19/input/16 diff --git a/solutions/input/17 b/19/input/17 index 84520cf..84520cf 100644 --- a/solutions/input/17 +++ b/19/input/17 diff --git a/solutions/py/d01.py b/19/py/d01.py index d1c57c8..d1c57c8 100644 --- a/solutions/py/d01.py +++ b/19/py/d01.py diff --git a/solutions/py/d02.py b/19/py/d02.py index 6b5aa0a..6b5aa0a 100644 --- a/solutions/py/d02.py +++ b/19/py/d02.py diff --git a/solutions/py/d03.py b/19/py/d03.py index 2454cb3..70bf9f0 100644 --- a/solutions/py/d03.py +++ b/19/py/d03.py @@ -1,3 +1,4 @@ +from profilehooks import coverage import math def intersection(l1, l2): @@ -8,6 +9,7 @@ def intersection(l1, l2): def man_dist(point): return abs(point[0]) + abs(point[1]) +#@coverage def pt1(input): wire1 = [] wire2 = [] @@ -39,6 +41,7 @@ def pt1(input): dist = min(dist, man_dist(point)) return dist +#@coverage def pt2(input): wire1 = {} wire2 = {} @@ -75,10 +78,6 @@ def pt2(input): return length if __name__ == "__main__": - import cProfile - input = open("../input/03", "r").readlines() - cProfile.run("pt1(input)") - cProfile.run("pt2(input)") print(pt1(input)) print(pt2(input)) diff --git a/solutions/py/d04.py b/19/py/d04.py index c9bcbf3..c9bcbf3 100644 --- a/solutions/py/d04.py +++ b/19/py/d04.py diff --git a/solutions/py/d05.py b/19/py/d05.py index 1415b99..1415b99 100644 --- a/solutions/py/d05.py +++ b/19/py/d05.py diff --git a/solutions/py/d06.py b/19/py/d06.py index 0b54362..0b54362 100644 --- a/solutions/py/d06.py +++ b/19/py/d06.py diff --git a/solutions/py/d07.py b/19/py/d07.py index 7ab2fe6..7ab2fe6 100644 --- a/solutions/py/d07.py +++ b/19/py/d07.py diff --git a/solutions/py/d08.py b/19/py/d08.py index 7df2aec..7df2aec 100644 --- a/solutions/py/d08.py +++ b/19/py/d08.py diff --git a/solutions/py/d09.py b/19/py/d09.py index ada6763..ada6763 100644 --- a/solutions/py/d09.py +++ b/19/py/d09.py diff --git a/solutions/py/d10.py b/19/py/d10.py index 0d918d9..0d918d9 100644 --- a/solutions/py/d10.py +++ b/19/py/d10.py diff --git a/solutions/py/d11.py b/19/py/d11.py index e9b280c..e9b280c 100644 --- a/solutions/py/d11.py +++ b/19/py/d11.py diff --git a/solutions/py/d12.py b/19/py/d12.py index 3d2b636..878acc6 100644 --- a/solutions/py/d12.py +++ b/19/py/d12.py @@ -1,5 +1,5 @@ import itertools -import primefac +#import primefac class Moon(object): def __init__(self, x, y, z): @@ -48,6 +48,7 @@ class Moon(object): return self.get_x, self.get_y, self.get_z def pt1(input): + return moons = [] for line in input: @@ -92,6 +93,7 @@ def get_cycle(init_pos, init_vel): return iters def pt2(input): + return moons = [] xs = 0 ys = 0 diff --git a/solutions/py/d13.py b/19/py/d13.py index 3dbc5fb..3dbc5fb 100644 --- a/solutions/py/d13.py +++ b/19/py/d13.py diff --git a/solutions/py/d14.py b/19/py/d14.py index 1d628a4..1d628a4 100644 --- a/solutions/py/d14.py +++ b/19/py/d14.py diff --git a/solutions/py/d15.py b/19/py/d15.py index b2a9b10..b2a9b10 100644 --- a/solutions/py/d15.py +++ b/19/py/d15.py diff --git a/solutions/py/d16.py b/19/py/d16.py index 93b52d2..93b52d2 100644 --- a/solutions/py/d16.py +++ b/19/py/d16.py diff --git a/solutions/py/d17.py b/19/py/d17.py index 42ba045..b12e03a 100644 --- a/solutions/py/d17.py +++ b/19/py/d17.py @@ -282,29 +282,17 @@ def pt2(input): s += str(instruction[0]) + "," + str(instruction[1]) + "\n" #print(s) - # hard-coded >:( - main_routine = "A,A,B,C,C,A,C,B,C,B" - routine_a = "L,4,L,4,L,6,R,10,L,6" - routine_b = "L,12,L,6,R,10,L,6" - routine_c = "R,8,R,10,L,6" - - msg = deque() - for s in [main_routine, routine_a, routine_b, routine_c]: - for ch in s: - msg.append(ord(ch)) - msg.append(10) - msg.append(ord("n")) - msg.append(10) - #print(msg) - c.reset() c.memory[0] = 2 + c.queue_ascii("A,A,B,C,C,A,C,B,C,B") + c.queue_ascii("L,4,L,4,L,6,R,10,L,6") + c.queue_ascii("L,12,L,6,R,10,L,6") + c.queue_ascii("R,8,R,10,L,6") + c.queue_ascii("n") + c.SIG_ASCII = True output = [] while not c.SIG_HALT: c.step() - if c.SIG_INPUT: - c.input = msg.popleft() - c.SIG_INPUT = False if c.SIG_OUTPUT: output.append(c.output) c.output = None diff --git a/solutions/py/intcode.py b/19/py/intcode.py index 694fee0..6079250 100644 --- a/solutions/py/intcode.py +++ b/19/py/intcode.py @@ -1,7 +1,8 @@ +from collections import deque param_amount = {1:3, 2:3, 3:1, 4:1, 5:2, 6:2, 7:3, 8:3, 9:1, 99:0} ADD = 1 -MULT = 2 +MUL = 2 IN = 3 OUT = 4 JNZ = 5 @@ -14,20 +15,9 @@ HAL = 99 class Computer(object): def __init__(self, program): self.program = program - self.memory = self.program.copy() self.memory_size = len(self.program) - self.extra_memory = {} - self.instruction_cache = {} - self.pointer = 0 - self.phase_read = False # for day 7 - self.relative_base = 0 - - self.input = None - self.output = None - self.SIG_INPUT = False - self.SIG_OUTPUT = False - self.SIG_HALT = False + self.reset() def reset(self): self.memory = self.program.copy() @@ -38,15 +28,17 @@ class Computer(object): self.relative_base = 0 self.input = None - self.ouput = None + self.input_queue = deque() + self.output = None self.SIG_INPUT = False + self.SIG_ASCII = False self.SIG_OUTPUT = False self.SIG_HALT = False def parse_op(self, op): - if op in self.instruction_cache: - return self.instruction_cache[op] + # if op in self.instruction_cache: + # return self.instruction_cache[op] code = op % 100 ops = str(op).zfill(param_amount[code]+2) self.instruction_cache[op] = [code] + [int(x) for x in ops[:-2][::-1]] @@ -84,6 +76,19 @@ class Computer(object): elif inst[num] == 2: self.write(self.relative_base + self.get(self.pointer + num), val) + def queue_input(self, data: list): + for val in data: + self.input_queue.append(data) + + def queue_ascii(self, data: str, newline=True): + for c in data: + if c == "\n": + self.input_queue.append(10) + else: + self.input_queue.append(ord(c)) + if newline: + self.input_queue.append(10) + def step(self): if self.SIG_OUTPUT and self.output is None: self.SIG_OUTPUT = False @@ -98,11 +103,13 @@ class Computer(object): self.write_param(inst, 3, \ self.get_param(inst, 1) + self.get_param(inst, 2)) self.pointer += 4 - elif inst[0] == MULT: + elif inst[0] == MUL: self.write_param(inst, 3, \ self.get_param(inst, 1) * self.get_param(inst, 2)) self.pointer += 4 elif inst[0] == IN: + if self.SIG_ASCII and len(self.input_queue) != 0: + self.input = self.input_queue.popleft() if self.input is None: self.SIG_INPUT = True return diff --git a/19/py/main.py b/19/py/main.py new file mode 100644 index 0000000..c45bac7 --- /dev/null +++ b/19/py/main.py @@ -0,0 +1,52 @@ +import time + +import d01 +import d02 +import d03 +import d04 +import d05 +import d06 +import d07 +import d08 +import d09 +import d10 +import d11 +import d12 +import d13 +import d14 +import d15 +import d16 +import d17 + +mods = [d01, d02, d03, d04, d05, d06, d07, d08, d09, d10, \ + d11, d12, d13, d14, d15, d16, d17] + +skip = [12, 16] + +timings = [[0 for _ in range(2)] for _ in range(len(mods))] +#clock_type = time.CLOCK_MONOTONIC + +for mod, day in zip(mods, range(len(mods))): + if day+1 in skip: + continue + print("Day", str(day+1).zfill(2)) + #t0 = time.clock_gettime_ns(clock_type) + print("Part", 1, mod.pt1(open("../input/" + str(day+1).zfill(2), "r").readlines())) + #timings[day][0] = time.clock_gettime_ns(clock_type) - t0 + #t0 = time.clock_gettime_ns(clock_type) + print("Part", 2, mod.pt2(open("../input/" + str(day+1).zfill(2), "r").readlines())) + #timings[day][1] = time.clock_gettime_ns(clock_type) - t0 + +#print() +#tot = 0 +#for day in range(len(timings)): +# for part in range(2): +# tot += timings[day][part] +#for day in range(len(timings)): +# if day+1 in skip: +# print("day {0} skipped".format(str(day+1))) +# else: +# for part in range(2): +# print("day {0}-{1}: {2:.2f}ms\t({3:.1f}%)".format(str(day+1).zfill(2), part+1, \ +# timings[day][part] / 1000000, 100*timings[day][part] / tot)) +#print("sum", tot / 1000000, "ms") diff --git a/solutions/cpp/02.in b/solutions/cpp/02.in deleted file mode 100644 index 0d5c091..0000000 --- a/solutions/cpp/02.in +++ /dev/null @@ -1 +0,0 @@ -1 0 0 3 1 1 2 3 1 3 4 3 1 5 0 3 2 6 1 19 2 19 9 23 1 23 5 27 2 6 27 31 1 31 5 35 1 35 5 39 2 39 6 43 2 43 10 47 1 47 6 51 1 51 6 55 2 55 6 59 1 10 59 63 1 5 63 67 2 10 67 71 1 6 71 75 1 5 75 79 1 10 79 83 2 83 10 87 1 87 9 91 1 91 10 95 2 6 95 99 1 5 99 103 1 103 13 107 1 107 10 111 2 9 111 115 1 115 6 119 2 13 119 123 1 123 6 127 1 5 127 131 2 6 131 135 2 6 135 139 1 139 5 143 1 143 10 147 1 147 2 151 1 151 13 0 99 2 0 14 0 diff --git a/solutions/input/15 b/solutions/input/15 deleted file mode 100644 index 6cc86a8..0000000 --- a/solutions/input/15 +++ /dev/null @@ -1 +0,0 @@ -3,1033,1008,1033,1,1032,1005,1032,31,1008,1033,2,1032,1005,1032,58,1008,1033,3,1032,1005,1032,81,1008,1033,4,1032,1005,1032,104,99,101,0,1034,1039,1001,1036,0,1041,1001,1035,-1,1040,1008,1038,0,1043,102,-1,1043,1032,1,1037,1032,1042,1105,1,124,101,0,1034,1039,101,0,1036,1041,1001,1035,1,1040,1008,1038,0,1043,1,1037,1038,1042,1106,0,124,1001,1034,-1,1039,1008,1036,0,1041,1001,1035,0,1040,1001,1038,0,1043,1002,1037,1,1042,1105,1,124,1001,1034,1,1039,1008,1036,0,1041,102,1,1035,1040,101,0,1038,1043,1002,1037,1,1042,1006,1039,217,1006,1040,217,1008,1039,40,1032,1005,1032,217,1008,1040,40,1032,1005,1032,217,1008,1039,1,1032,1006,1032,165,1008,1040,33,1032,1006,1032,165,1101,0,2,1044,1106,0,224,2,1041,1043,1032,1006,1032,179,1101,1,0,1044,1106,0,224,1,1041,1043,1032,1006,1032,217,1,1042,1043,1032,1001,1032,-1,1032,1002,1032,39,1032,1,1032,1039,1032,101,-1,1032,1032,101,252,1032,211,1007,0,43,1044,1105,1,224,1101,0,0,1044,1106,0,224,1006,1044,247,1002,1039,1,1034,1002,1040,1,1035,102,1,1041,1036,1001,1043,0,1038,101,0,1042,1037,4,1044,1105,1,0,13,30,60,64,5,28,36,24,67,12,1,67,32,39,14,78,29,17,38,88,79,9,62,25,15,18,88,25,7,81,38,41,10,69,86,32,11,33,1,10,22,84,14,92,48,79,10,3,62,33,61,13,93,78,20,63,68,17,80,34,12,8,23,61,90,51,17,84,37,46,64,25,3,73,19,45,99,41,62,21,77,8,17,89,9,13,84,75,85,14,53,60,6,29,76,63,14,23,63,61,93,72,17,41,28,94,5,3,19,47,57,55,14,34,38,79,85,40,13,22,99,67,72,15,62,15,6,63,3,90,2,87,20,84,15,50,70,27,18,78,21,70,48,52,2,99,92,55,3,46,41,93,99,88,13,39,4,45,71,3,96,1,91,59,31,53,23,25,82,32,50,16,60,38,78,34,59,30,15,51,92,3,22,26,62,60,37,42,74,28,21,76,7,24,70,18,40,11,81,41,9,73,62,12,66,81,9,3,74,62,11,6,56,16,34,20,78,79,1,97,17,39,87,15,12,77,94,28,22,66,45,59,39,2,6,52,6,72,49,17,92,15,86,18,92,79,67,20,22,72,10,72,3,52,26,77,78,41,97,36,59,88,24,57,12,38,90,53,14,38,67,2,36,44,93,99,10,41,49,3,16,7,63,32,11,15,81,12,91,39,62,19,83,6,91,28,19,80,38,23,63,31,71,14,58,8,21,71,21,21,81,38,26,32,29,82,52,28,72,54,97,41,65,96,75,1,48,28,80,66,25,47,49,29,87,51,12,50,70,36,60,81,29,77,76,55,25,40,45,83,91,26,72,99,12,47,11,20,27,52,9,98,17,99,27,37,62,25,3,15,73,66,22,5,85,5,20,98,20,38,62,78,21,16,59,28,98,38,31,2,40,46,87,14,48,33,80,48,36,27,56,21,1,50,83,3,61,92,20,52,16,50,10,86,9,98,39,56,25,50,42,39,91,81,56,25,70,44,24,15,99,4,20,55,12,98,27,65,20,77,97,76,36,42,87,6,11,79,65,16,65,44,13,90,13,48,79,13,95,60,19,55,24,66,4,53,11,23,68,14,97,53,45,14,16,93,18,29,83,5,6,77,19,70,97,34,20,70,52,11,74,14,72,10,36,44,33,45,19,38,36,77,5,37,51,1,55,17,2,48,23,18,2,34,90,97,24,30,51,66,33,70,51,37,31,51,37,65,55,18,8,66,4,65,62,26,93,29,88,3,75,73,24,23,67,1,13,68,7,36,87,62,48,1,31,45,28,62,86,24,98,1,59,49,37,26,62,36,44,66,18,17,97,92,40,36,65,80,84,5,84,6,79,87,36,31,96,15,71,96,2,72,11,81,95,94,41,54,31,58,25,74,24,51,81,38,32,73,22,96,40,62,22,59,74,39,25,86,2,55,20,61,40,37,88,69,1,60,42,18,31,54,13,27,19,93,34,41,99,33,89,20,16,52,84,32,94,31,6,61,25,1,61,1,38,78,87,39,31,39,26,68,42,36,2,94,66,2,67,30,80,2,95,65,40,54,50,33,11,23,97,89,1,31,56,9,35,49,92,55,23,84,48,91,20,7,72,25,55,3,85,3,16,40,90,22,99,44,38,86,98,11,76,26,76,13,82,80,24,93,4,15,64,95,58,15,85,25,57,29,66,3,66,19,98,57,24,44,59,35,76,48,31,92,33,94,68,56,41,45,15,46,5,68,15,65,34,73,49,68,17,78,28,80,24,59,26,74,21,52,1,94,5,61,41,88,37,56,1,49,0,0,21,21,1,10,1,0,0,0,0,0,0 diff --git a/solutions/py/main.py b/solutions/py/main.py deleted file mode 100644 index cc0f04c..0000000 --- a/solutions/py/main.py +++ /dev/null @@ -1,52 +0,0 @@ -import time - -import d01 -import d02 -import d03 -import d04 -import d05 -import d06 -import d07 -import d08 -import d09 -import d10 -import d11 -import d12 -import d13 -import d14 -import d15 -import d16 -import d17 - -mods = [d01, d02, d03, d04, d05, d06, d07, d08, d09, d10, \ - d11, d12, d13, d14, d15, d16, d17] - -skip = [12, 16] - -timings = [[0 for _ in range(2)] for _ in range(len(mods))] -clock_type = time.CLOCK_MONOTONIC - -for mod, day in zip(mods, range(len(mods))): - if day+1 in skip: - continue - print("Day", str(day+1).zfill(2)) - t0 = time.clock_gettime_ns(clock_type) - print("Part", 1, mod.pt1(open("../input/" + str(day+1).zfill(2), "r").readlines())) - timings[day][0] = time.clock_gettime_ns(clock_type) - t0 - t0 = time.clock_gettime_ns(clock_type) - print("Part", 2, mod.pt2(open("../input/" + str(day+1).zfill(2), "r").readlines())) - timings[day][1] = time.clock_gettime_ns(clock_type) - t0 - -print() -tot = 0 -for day in range(len(timings)): - for part in range(2): - tot += timings[day][part] -for day in range(len(timings)): - if day+1 in skip: - print("day {0} skipped".format(str(day+1))) - else: - for part in range(2): - print("day {0}-{1}: {2:.2f}ms\t({3:.1f}%)".format(str(day+1).zfill(2), part+1, \ - timings[day][part] / 1000000, 100*timings[day][part] / tot)) -print("sum", tot / 1000000, "ms") |
