[Python] BOJ 13023번. ABCDE 작성일 2020-09-02 | In Algorithm | 13023번. ABCDE 문제 링크 https://www.acmicpc.net/problem/13023 풀이 코드 123456789101112131415161718192021222324252627282930313233343536373839# 13023번. ABCDE import sys input = sys.stdin.readline n, m = map(int, input().split()) box = [[] for i in range(n)] for i in range(m): a, b = map(int, input().split()) box[a].append(b) box[b].append(a) visited = [False for i in range(n)] def dfs(index, cnt): global ans visited[index] = True if(cnt == 4): ans = True return for v in box[index]: if not visited[v]: dfs(v, cnt+1) visited[v] = False ans = False for i in range(n): dfs(i, 0) visited[i] = False if ans: break print(1 if ans else 0) 비고