전체 글 177

<백준> 10989번 파이썬 알고리즘

import sys n = int(sys.stdin.readline()) b = [0] * 10001 for i in range(n): b[int(sys.stdin.readline())] += 1 for i in range(10001): if b[i] != 0: for j in range(b[i]): print(i)​ 위와 같이 재출했더니 메모리 초과가 났다. sorted를 쓰면 안되는 건가 import sys n = int(sys.stdin.readline()) a = [0] * 10001 for _ in range(n): # m = int(sys.stdin.readline()) a[int(sys.stdin.readline())] += 1 for i in range(10001): if a[i] != 0..

알고리즘 2021.07.12

<백준> 10816번 파이썬 알고리즘

n = int(input()) l = list(map(int, input().split())) m = int(input()) k = list(map(int, input().split())) r = [] for i in k: r.append(l.count(i)) for j in r: print(j, end= " ") 시간 초과 났다 실버4 문제치고 너무 쉽다는 생각이 들긴했다 n = int(input()) l = list(map(int, input().split())) m = int(input()) k = list(map(int, input().split())) n_count = {} for i in l: try: n_count[i] += 1 except: n_count[i] = 1 res = [] for..

알고리즘 2021.07.11