Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions 허민권_15주차/[BOJ-18119] 단어 암기.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import sys
from collections import defaultdict
input = sys.stdin.readline


N,M = map(int,input().split())

words = defaultdict(int)

for _ in range(N):
s = set(input().strip())
mask = 1<<26
for i in range(26):
if chr(97+i) in s:
mask |= 1<<i
words[mask] += 1

remember_mask = (1<<27) - 1
for _ in range(M):
o,x = input().split()
if o == '1':
# forgot
if x in ['a', 'e','i','o','u']:
continue
remember_mask = remember_mask & ~(1<<(ord(x)-97))
else:
remember_mask |= (1<<(ord(x)-97))
total = 0
for word,cnt in words.items():
if remember_mask == remember_mask | word:
total += cnt
print(total)
33 changes: 33 additions & 0 deletions 허민권_15주차/[BOJ-3020] 개똥벌레.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from bisect import bisect_left
import sys
from collections import defaultdict

input = sys.stdin.readline
N, H = map(int, input().split())

top = []
bottom = []

for i in range(N):
if i%2==0:
bottom.append(int(input()))
else:
top.append(int(input()))

bottom.sort()
top.sort()



left,right = 1, H

count = defaultdict(int)
min_ans = N
for i in range(1, H+1):

b_cnt = len(bottom) - bisect_left(bottom,i)
t_cnt = len(top) - bisect_left(top, H-i+1)
total = b_cnt + t_cnt
min_ans = min(min_ans,total)
count[total] += 1
print(min_ans, count[min_ans])