From: Skullheadx <94652084+Skullheadx@users.noreply.github.com> Date: Thu, 5 Jan 2023 03:36:36 +0000 (-0500) Subject: 2018 S1 + grader upd X-Git-Url: http://git.skullheadx.com/nixos/static/batman.png?a=commitdiff_plain;h=470da04f9b2b32ca5594ef0fb2634f8edae78bc6;p=CCC.git 2018 S1 + grader upd --- diff --git a/Main/Python/2018/S1.py b/Main/Python/2018/S1.py new file mode 100644 index 0000000..310fccf --- /dev/null +++ b/Main/Python/2018/S1.py @@ -0,0 +1,27 @@ +from queue import PriorityQueue + +def halfway_length(a,b): + return abs(a-b)/2 + + +N = int(input()) + +q = PriorityQueue() + +for i in range(N): + V = int(input()) + q.put(V) + +prev = q.get() +prev_length = 1000000000 +smallest_length = None +while not q.empty(): + current = q.get() + d = halfway_length(current, prev) + prev_length += d + if smallest_length is None or prev_length < smallest_length: + smallest_length = prev_length + prev_length = d + prev = current + +print(smallest_length) \ No newline at end of file diff --git a/Main/Python/__pycache__/tester.cpython-310.pyc b/Main/Python/__pycache__/tester.cpython-310.pyc index ac18695..cde2f62 100644 Binary files a/Main/Python/__pycache__/tester.cpython-310.pyc and b/Main/Python/__pycache__/tester.cpython-310.pyc differ diff --git a/Main/Python/grader.py b/Main/Python/grader.py index a55c775..226ffc8 100644 --- a/Main/Python/grader.py +++ b/Main/Python/grader.py @@ -14,10 +14,10 @@ class Capturing(list): sys.stdout = self._stdout -PATH = "2012/" +PATH = "2018/" PROBLEM = "S1" -test_input_path = os.path.join(PATH, f"windows_data/senior/{PROBLEM}/") +test_input_path = os.path.join(PATH, f"senior/{PROBLEM}/") test_inputs = [] test_outputs = [] @@ -45,6 +45,8 @@ for test_input, test_output in zip(test_inputs, test_outputs): print(f"Test Failed. {round(end - start, 3)}s") print(f"{test_input = }") print(f"{test_output = }") + print(f"{output = }") + print() print("--------------------------------") print(f"Tests passed: {correct}/{total}") \ No newline at end of file