Compare commits

..

No commits in common. "bf896841d207107fd3ee0e52ff0c840ab2531219" and "618324bb179e65a0fe8b6f03810319b8019360dd" have entirely different histories.

View File

@ -1,7 +1,7 @@
import threading import threading
import time import time
text: str = open("input.txt", "r").read() text: str = open("example.txt", "r").read()
_value: int = 0 _value: int = 0
@ -57,39 +57,22 @@ def get_min_in_range(lst_conversions, start, stop):
min_value = do_all_convertions(lst_conversions, start) min_value = do_all_convertions(lst_conversions, start)
i = start + 1; i = start + 1;
while (i != stop): while (i != stop):
if ((i - start) % 10000 == 0):
display_duration(10000, stop - start)
print(i - start, '/', stop - start)
value = do_all_convertions(lst_conversions, i) value = do_all_convertions(lst_conversions, i)
#print(min_value, value, min(value, min_value)) print(min_value, value, min(value, min_value))
min_value = min(value, min_value) min_value = min(value, min_value)
i += 1 i += 1
return (min_value) return (min_value)
values = [] _min = 2000000000000000000
def thread_process(convertions, start_value, chunk):
global values
values.append(get_min_in_range(convertions, start_value, chunk))
CHUNK_SIZE = 10
for current_range in current_ranges: for current_range in current_ranges:
start, stop = current_range start, stop = current_range
i = start _min = min(_min, get_min_in_range(convertions, start, stop))
chunks = []
while(i < stop):
i += CHUNK_SIZE
if (i >= stop):
chunks.append(stop)
else:
chunks.append(i)
start_value = start
i = 0
while (i < len(chunks)):
t = threading.Thread(target=thread_process, args=(convertions, start_value, chunks[i]))
t.start()
display_duration(1, len(chunks))
print(i, '/', len(chunks))
i += 1
start_value = chunks[i - 1]
_value = min(values) _value = _min
print(_value) print(_value)