본문 바로가기

PS73

[테스트케이스추가] 백준 1269번: 대칭 차집합 python 파이썬 1. 문제 https://www.acmicpc.net/problem/1269 1269번: 대칭 차집합 첫째 줄에 집합 A의 원소의 개수와 집합 B의 원소의 개수가 빈 칸을 사이에 두고 주어진다. 둘째 줄에는 집합 A의 모든 원소가, 셋째 줄에는 집합 B의 모든 원소가 빈 칸을 사이에 두고 각각 주어 www.acmicpc.net 2. 풀이 3. 구현 # https://simsimjae.tistory.com/214 import sys sys.stdin =open('input.txt') # @profile def main(): a,b=map(int, sys.stdin.readline().strip().split()) a_lis = list(map(int, sys.stdin.readline().strip().s.. 2021. 8. 6.
백준 11279번: 최대힙 파이썬 1. 문제 https://www.acmicpc.net/problem/11279 11279번: 최대 힙 첫째 줄에 연산의 개수 N(1 ≤ N ≤ 100,000)이 주어진다. 다음 N개의 줄에는 연산에 대한 정보를 나타내는 정수 x가 주어진다. 만약 x가 자연수라면 배열에 x라는 값을 넣는(추가하는) 연산이고, x가 www.acmicpc.net 2. 풀이 3. 구현 # https://www.daleseo.com/python-priority-queue/ import sys # sys.stdin = open('input.txt') n = int(sys.stdin.readline().strip()) pq=[] import heapq # default maxsize: inf # default order: small.. 2021. 8. 6.
백준 1927번: 최소힙 python 파이썬 1. 문제 https://www.acmicpc.net/problem/1927 1927번: 최소 힙 첫째 줄에 연산의 개수 N(1 ≤ N ≤ 100,000)이 주어진다. 다음 N개의 줄에는 연산에 대한 정보를 나타내는 정수 x가 주어진다. 만약 x가 자연수라면 배열에 x라는 값을 넣는(추가하는) 연산이고, x가 0 www.acmicpc.net 2. 풀이 우선순위큐 3. 구현 import sys # sys.stdin = open('input.txt') import heapq lis = [] n = int(sys.stdin.readline().strip()) while n: n-=1 tmp = int(sys.stdin.readline().strip()) if tmp==0: if len(lis)==0: sys... 2021. 8. 6.
[테스트케이스 추가] 백준 16398 번: 행성연결, python 파이썬 1. 문제 https://www.acmicpc.net/problem/16398 16398번: 행성 연결 홍익 제국의 중심은 행성 T이다. 제국의 황제 윤석이는 행성 T에서 제국을 효과적으로 통치하기 위해서, N개의 행성 간에 플로우를 설치하려고 한다. 두 행성 간에 플로우를 설치하면 제국의 함 www.acmicpc.net 2. 풀이 3. 구현 # 최소한의 비용으로 모든 행성을 잇는 간선을 만든다 import sys # sys.stdin=open('input.txt') import heapq sys.setrecursionlimit(10**8) n = int(sys.stdin.readline().strip()) gph=[] for i in range(n): gph.append(list(map(int, sys.. 2021. 8. 6.
반응형