From 2662acb4b56502fabb1835a7d3f534239351f373 Mon Sep 17 00:00:00 2001 From: yenru0 Date: Sat, 10 Aug 2024 08:19:51 +0900 Subject: [PATCH] complete 25329.py --- zeta_python/completed/25329.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 zeta_python/completed/25329.py diff --git a/zeta_python/completed/25329.py b/zeta_python/completed/25329.py new file mode 100644 index 0000000..af5c45b --- /dev/null +++ b/zeta_python/completed/25329.py @@ -0,0 +1,28 @@ +import sys +import math + +input = sys.stdin.readline + + +def cost(time): + if time > 100: + return 10 + 3 * math.ceil((time - 100) / 50) + else: + return 10 + + +if __name__ == "__main__": + N = int(input()) + table: dict = {} + for _ in range(N): + time_str, name = input().rstrip().split() + if name not in table: + table[name] = (lambda a, b: a * 60 + b)(*map(int, time_str.split(":"))) + else: + table[name] += (lambda a, b: a * 60 + b)(*map(int, time_str.split(":"))) + + for c, n in sorted( + [(cost(value), name) for name, value in table.items()], + key=lambda x: (-x[0], x[1]), + ): + print(n, c)