From 2298b4ddff3a12e30ccb4d923384b9058709c080 Mon Sep 17 00:00:00 2001 From: gmlrude Date: Wed, 30 Apr 2025 15:16:34 +0900 Subject: [PATCH 1/3] =?UTF-8?q?114=EC=B0=A8=201=EB=B2=88=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=ED=92=80=EC=9D=B4(=EC=B0=B8=EA=B3=A0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\353\260\225\355\235\254\352\262\275.py" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "live11/test114/\353\254\270\354\240\2341/\353\260\225\355\235\254\352\262\275.py" diff --git "a/live11/test114/\353\254\270\354\240\2341/\353\260\225\355\235\254\352\262\275.py" "b/live11/test114/\353\254\270\354\240\2341/\353\260\225\355\235\254\352\262\275.py" new file mode 100644 index 00000000..09b5bfab --- /dev/null +++ "b/live11/test114/\353\254\270\354\240\2341/\353\260\225\355\235\254\352\262\275.py" @@ -0,0 +1,27 @@ +import sys +from itertools import * + +input = sys.stdin.readline + +expr= list(map(str, input().rstrip())) + +stack = [] +pairs = [] +for idx, char in enumerate(expr): + if char == '(': + stack.append(idx) + elif char == ')': + open_idx = stack.pop() + pairs.append((open_idx, idx)) + +res = set() +for i in range(1, len(pairs) + 1): + for comb in combinations(pairs, i): + temp = list(expr) + for open_idx, close_idx in comb: + temp[open_idx] = '' + temp[close_idx] = '' + res.add(''.join(temp)) + +for r in sorted(res): + print(r) From bfde30d4d79896b1946dfbd32ba9939647b5a8b4 Mon Sep 17 00:00:00 2001 From: gmlrude Date: Wed, 30 Apr 2025 15:37:13 +0900 Subject: [PATCH 2/3] =?UTF-8?q?114=EC=B0=A8=202=EB=B2=88=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=ED=92=80=EC=9D=B4(=ED=91=B8=EB=8A=94=EC=A4=91)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\353\260\225\355\235\254\352\262\275.py" | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 "live11/test114/\353\254\270\354\240\2342/\353\260\225\355\235\254\352\262\275.py" diff --git "a/live11/test114/\353\254\270\354\240\2342/\353\260\225\355\235\254\352\262\275.py" "b/live11/test114/\353\254\270\354\240\2342/\353\260\225\355\235\254\352\262\275.py" new file mode 100644 index 00000000..f108303c --- /dev/null +++ "b/live11/test114/\353\254\270\354\240\2342/\353\260\225\355\235\254\352\262\275.py" @@ -0,0 +1,23 @@ +import sys + + +input = sys.stdin.readline + +n = int(input()) +radius = [] +for _ in range(n): + x, r = map(int, input().split()) + radius.append((x-r, x+r)) + +radius.sort() +flag = 'YES' +for i in range(len(radius) - 1): + if radius[i][0] < radius[i+1][0]: + if radius[i][1] > radius[i+1][1]: # 안에 있는 경우 + continue + else: + flag = 'NO' + if radius[i][1] < radius[i+1][0]: + continue + +print(flag) \ No newline at end of file From 57ec8ad6e4869b5318cb00ae4228ee9339c5f4c5 Mon Sep 17 00:00:00 2001 From: gmlrude Date: Wed, 30 Apr 2025 18:55:10 +0900 Subject: [PATCH 3/3] =?UTF-8?q?114=EC=B0=A8=202=EB=B2=88=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=EB=8B=A4=EC=8B=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\225\355\235\254\352\262\275.py" | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git "a/live11/test114/\353\254\270\354\240\2342/\353\260\225\355\235\254\352\262\275.py" "b/live11/test114/\353\254\270\354\240\2342/\353\260\225\355\235\254\352\262\275.py" index f108303c..edc433a6 100644 --- "a/live11/test114/\353\254\270\354\240\2342/\353\260\225\355\235\254\352\262\275.py" +++ "b/live11/test114/\353\254\270\354\240\2342/\353\260\225\355\235\254\352\262\275.py" @@ -10,14 +10,18 @@ radius.append((x-r, x+r)) radius.sort() + flag = 'YES' -for i in range(len(radius) - 1): - if radius[i][0] < radius[i+1][0]: - if radius[i][1] > radius[i+1][1]: # 안에 있는 경우 - continue - else: +stack = [] +for start, end in radius: + if not stack: + stack.append((start, end)) + else: + pre_start, pre_end = stack.pop() + if pre_start >= start or pre_end == start: # 맞닿아 있을 때 flag = 'NO' - if radius[i][1] < radius[i+1][0]: - continue - -print(flag) \ No newline at end of file + break + if pre_end > start and pre_end <= end: # 겹칠 때 + flag = 'NO' + break +print(flag)