From 6d331c26c244ea0244012faa5464cbfee3d2a538 Mon Sep 17 00:00:00 2001 From: gjsk132 Date: Tue, 8 Oct 2024 17:40:00 +0900 Subject: [PATCH] 42-gjsk132 --- .../1034 \353\236\250\355\224\204.py" | 32 +++++++++++++++++++ gjsk132/README.md | 1 + 2 files changed, 33 insertions(+) create mode 100644 "gjsk132/Implementation/1034 \353\236\250\355\224\204.py" diff --git "a/gjsk132/Implementation/1034 \353\236\250\355\224\204.py" "b/gjsk132/Implementation/1034 \353\236\250\355\224\204.py" new file mode 100644 index 0000000..cf5e198 --- /dev/null +++ "b/gjsk132/Implementation/1034 \353\236\250\355\224\204.py" @@ -0,0 +1,32 @@ +from collections import defaultdict + +input = open(0).readline + +n, m = map(int,input().split()) + +answer = 0 + +table = defaultdict(int) + +for _ in range(n): + row = input().rstrip() + table[row] += 1 + +turn_on_off_cnt = int(input()) + +table = list(table.items()) +table.sort(key=lambda x: -x[1]) + +for row, cnt in table: + need_switch_on = m - sum(list(map(int,row))) + + if turn_on_off_cnt < need_switch_on: + continue + + if (turn_on_off_cnt - need_switch_on)%2==1: + continue + + answer = cnt + break + +print(answer) \ No newline at end of file diff --git a/gjsk132/README.md b/gjsk132/README.md index 10725b8..5801c07 100644 --- a/gjsk132/README.md +++ b/gjsk132/README.md @@ -41,3 +41,4 @@ | 39차시 | 2024.05.29 | Dijkstra | [11781 퇴근 시간](https://www.acmicpc.net/problem/11781) | [🚌](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/183) | | 40차시 | 2024.06.04 | BitMasking | [[1차] 비밀지도](https://school.programmers.co.kr/learn/courses/30/lessons/17681) | [🗺️](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/190) | | 41차시 | 2024.07.01 | TSP | [2098 외판원 순회](https://www.acmicpc.net/problem/2098) | [✈️](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/195) | +| 42차시 | 2024.10.08 | Implementation | [1034 램프](https://www.acmicpc.net/problem/1034) | [💡](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/231) | \ No newline at end of file