====== 방 배정 ====== ===== 풀이 ===== * 총 12개의 {학년}x{성별} 조합에 대해서 인원이 몇명인지를 체크하고, 인원수에 따라서 몇개의 방이 필요한지 계산해서 다 더해주면 된다. * 시간복잡도는 O(n) ===== 코드 ===== """Solution code for "BOJ 13300. 방 배정". - Problem link: https://www.acmicpc.net/problem/13300 - Solution link: http://www.teferi.net/ps/problems/boj/13300 """ import collections import sys def main(): N, K = [int(x) for x in sys.stdin.readline().split()] count = collections.defaultdict(int) for _ in range(N): S, Y = [int(x) for x in sys.stdin.readline().split()] count[S, Y] += 1 print(sum((x + K - 1) // K for x in count.values())) if __name__ == '__main__': main() {{tag>BOJ ps:problems:boj:브론즈_2}}