Skip to content

Instantly share code, notes, and snippets.

View inspirit941's full-sized avatar

Donggeon Lee inspirit941

View GitHub Profile
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the bigSorting function below.
def bigSorting(unsorted):
#!/bin/python3
import math
import os
import random
import re
import sys
from collections import deque, defaultdict
# Complete the findShortest function below.
from itertools import chain
# 2d Array에서 네 개의 문자열이 사각형 모양으로 일치할 경우를 파악하기
def find_square(maps):
table = [[0 for _ in range(len(maps))] for _ in range(len(maps))]
for y in range(1, len(maps)):
for x in range(1, len(maps)):
if maps[y-1][x-1] == maps[y-1][x] == maps[y][x-1] == maps[y][x] and maps[y][x] != "#":
table[y-1][x-1] += 1
table[y-1][x] += 1
table[y][x-1] += 1
import sys
n = int(sys.stdin.readline())
maps = [list(map(int, sys.stdin.readline().split())) for _ in range(n)]
# 해당 좌표로 이동할 수 있는 방법의 개수
table = [[0 for _ in range(n)] for _ in range(n)]
# 시작지점은 1로 정의
table[0][0] = 1
for y in range(n):
for x in range(n):
import sys
n, m = map(int, sys.stdin.readline().split())
maps = [list(map(int, sys.stdin.readline().split())) for _ in range(n)]
answer = 0
def check_shape(maps, shape):
global answer
y_length = len(maps) - len(shape)
x_length = len(maps[0]) - len(shape[0])
for start_y in range(y_length + 1):
def solution(msg):
table = dict()
for idx, value in enumerate("ABCDEFGHIJKLMNOPQRSTUVWXYZ",1):
table[value] = idx
last_idx = idx
idx = 1
answer = []
letter = msg[0]
while idx < len(msg):
# 현재 입력 + 다음 글자 조합이 색인에 없는 경우
import sys
from collections import deque
def bfs(start, maps, visited):
queue = deque()
queue.append(start)
while queue:
y = queue.popleft()
visited.add(y)
for x in range(1, len(maps[y])):
import sys
from collections import deque
import math
from itertools import combinations
n = int(sys.stdin.readline())
populations = list(map(int, sys.stdin.readline().split()))
populations.insert(0, 0)
maps = [[0 for _ in range(n+1)] for _ in range(n+1)]
import sys
from itertools import chain
from copy import deepcopy
n = int(sys.stdin.readline())
maps = [list(map(int, sys.stdin.readline().split())) for _ in range(n)]
max_value = 0
# 앞으로 기울이기 - 0
# 뒤로 기울이기 - 1
# 오른쪽으로 기울이기 - 2
import sys
from collections import deque
def bfs(start, connected):
queue = deque()
queue.append(start)
visited = [0 for _ in range(N+1)]
count = 1
while queue:
current = queue.popleft()