크래프톤 정글 주제별 탐구 -그래프-4색정리-
문제 지도 위의 모든 나라를 색칠하는데, 인접한 나라끼리 색이 겹치지 않게끔 칠하려면 4가지 색만으로도 충분한지를 따지는 문제다. 이는 위상 정렬으로 푸는 문제이다. 관련 문제 5색정리
문제 지도 위의 모든 나라를 색칠하는데, 인접한 나라끼리 색이 겹치지 않게끔 칠하려면 4가지 색만으로도 충분한지를 따지는 문제다. 이는 위상 정렬으로 푸는 문제이다. 관련 문제 5색정리
문제 링크 11279번 해결책 import sys class PriorityQueue: def __init__(self, capacity: int = 9999999) -> None: self.arr = [None] * capacity self.capacity = capacity self.siz...
문제 링크 18258번 해결책 import sys class Node: def __init__(self, val: int): self.val = val self.ptr = None class Queue: def __init__(self, limit: int = 1000): self.st...
문제 링크 11866번 해결책 import sys class Node: def __init__(self, val: int): self.val = val self.ptr = None class Circle_queue: def __init__(self, limit: int = 1000): ...
문제 링크 2493번 해결책 import sys N = int(sys.stdin.readline().rstrip()) nums = list(map(int, sys.stdin.readline().rstrip().split())) tempStack = [] for i in range(N): fin = False while len(t...
문제 링크 10828번 해결책 from typing import Any import sys class Stack: '''class Empty(Exception): pass class Full(Exception): pass ''' def __init__(self, capacity: int ...
문제 링크 8983번 해결책 import sys M, N, L = map(int, sys.stdin.readline().rstrip().split()) xList = list(map(int, sys.stdin.readline().rstrip().split())) animalList = [] ableList = [] xList.sort() ...
문제 링크 1629번 해결책 import sys A, B, C = map(int, sys.stdin.readline().rstrip().split()) remainArr = [] pattern = [] def findRemain(a, b, c): # b -> 2 / 2 / 2 / 2 # 이런식이라고 생각해보자. # ...
문제 링크 2630번 해결책 import sys N = int(sys.stdin.readline().rstrip()) paperColor = [] for i in range(N): paperColor.append(list(map(int, sys.stdin.readline().rstrip().split()))) # 파란색 수(칸의 총합)에...
문제 링크 2805번 해결책 import sys def result_CutTree(arr, cut): result = 0 for i in arr: if (i > cut): result += (i - cut) return result def treeCuttingSearch(_min,...