From 84739e5e01d74beb7b64357196753e755b9eb307 Mon Sep 17 00:00:00 2001 From: yenru0 Date: Tue, 30 Jul 2024 18:50:36 +0900 Subject: [PATCH] complete 15889.py --- zeta_python/completed/15889.py | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 zeta_python/completed/15889.py diff --git a/zeta_python/completed/15889.py b/zeta_python/completed/15889.py new file mode 100644 index 0000000..b26322c --- /dev/null +++ b/zeta_python/completed/15889.py @@ -0,0 +1,35 @@ +if __name__ == "__main__": + N = int(input()) + X = list(map(int, input().split())) + if N == 1: + R = [0] + else: + R = list(map(int, input().split())) + [0] + Y = [] + Y.append((X[0], R[0])) + for i in range(1, N): + if Y[-1][0] == X[i]: + if Y[-1][1] < R[i]: + Y.pop() + Y.append((X[i], R[i])) + else: + Y.append((X[i], R[i])) + + flag = True + max_length = 0 + + for i in range(len(Y) - 1): + max_length = max([max_length, sum(Y[i])]) + if max_length >= Y[i+1][0]: + continue + else: + flag = False + break + else: + flag = True + + ( + print("권병장님, 중대장님이 찾으십니다") + if flag + else print("엄마 나 전역 늦어질 것 같아") + )