From d3cc058d7aff76c6aeb65be3d43bf3469c88b21b Mon Sep 17 00:00:00 2001 From: hangyeol Date: Wed, 23 Apr 2025 15:12:46 +0900 Subject: [PATCH 1/3] =?UTF-8?q?111=EC=B0=A8=201=EB=B2=88=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\353\260\261\355\225\234\352\262\260.py" | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 "live11/test111/\353\254\270\354\240\2341/\353\260\261\355\225\234\352\262\260.py" diff --git "a/live11/test111/\353\254\270\354\240\2341/\353\260\261\355\225\234\352\262\260.py" "b/live11/test111/\353\254\270\354\240\2341/\353\260\261\355\225\234\352\262\260.py" new file mode 100644 index 00000000..872a7c2e --- /dev/null +++ "b/live11/test111/\353\254\270\354\240\2341/\353\260\261\355\225\234\352\262\260.py" @@ -0,0 +1,29 @@ +import sys + +def main(): + input = sys.stdin.readline + N = int(input()) + pair = [] + totalA = 0 + + for _ in range(N): + X, A = map(int, input().split()) + pair.append((X, A)) + totalA += A + + pair.sort(key=lambda x:x[0]) + + medium = (totalA+1) // 2 + + sumA = 0 + + for x, a in pair: + sumA += a + + if sumA >= medium: + print(x) + break + + +if __name__ == '__main__': + main() \ No newline at end of file From ce7036d2b4d36d22b81a6ab33a3b1fc214010ba0 Mon Sep 17 00:00:00 2001 From: hangyeol Date: Wed, 23 Apr 2025 15:12:52 +0900 Subject: [PATCH 2/3] =?UTF-8?q?111=EC=B0=A8=202=EB=B2=88=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\353\260\261\355\225\234\352\262\260.py" | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 "live11/test111/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" diff --git "a/live11/test111/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" "b/live11/test111/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" new file mode 100644 index 00000000..f3f4a8f1 --- /dev/null +++ "b/live11/test111/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" @@ -0,0 +1,32 @@ +import sys + +def main(): + + input = sys.stdin.readline + N = int(input()) + + calendar = [0 for _ in range(365)] + + for _ in range(N): + S, E = map(int, input().split()) + + for date in range(S, E+1): + calendar[date] += 1 + + total = 0 + maxHeight = 0 + count = 0 + + for date in range(len(calendar)): + if calendar[date] != 0: + maxHeight = max(calendar[date], maxHeight) + count += 1 + if calendar[date] == 0: + total += count * maxHeight + count = 0 + maxHeight = 0 + + print(total) + +if __name__ == '__main__': + main() \ No newline at end of file From e1984da60106b878c8d2be5bd04c20d49c90b40d Mon Sep 17 00:00:00 2001 From: hangyeol Date: Thu, 24 Apr 2025 23:56:57 +0900 Subject: [PATCH 3/3] =?UTF-8?q?111=EC=B0=A8=202=EB=B2=88=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\353\260\261\355\225\234\352\262\260.py" | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git "a/live11/test111/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" "b/live11/test111/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" index f3f4a8f1..6e161dea 100644 --- "a/live11/test111/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" +++ "b/live11/test111/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" @@ -1,15 +1,13 @@ import sys def main(): - input = sys.stdin.readline N = int(input()) - calendar = [0 for _ in range(365)] + calendar = [0 for _ in range(366)] for _ in range(N): S, E = map(int, input().split()) - for date in range(S, E+1): calendar[date] += 1 @@ -21,11 +19,14 @@ def main(): if calendar[date] != 0: maxHeight = max(calendar[date], maxHeight) count += 1 - if calendar[date] == 0: + else: total += count * maxHeight count = 0 maxHeight = 0 + if count > 0: + total += count * maxHeight + print(total) if __name__ == '__main__':