Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 학습
- you only look once
- tacotron
- 윈도우
- YOLO
- DCTTS
- 타코트론
- 딥러닝 보코더
- 한국어 tts
- Vocoder
- melgan
- 음성 합성
- deep voice
- singing voice synthesis
- 보코더
- 딥러닝 음성 합성
- waveglow
- korean tts
- 한국어 음성 합성
- 트레이닝
- TTS
- text-to-speech
- 딥러닝
- 노래합성
Archives
- Today
- Total
chldkato
백준 14889 스타트와 링크 (파이썬) 본문
https://www.acmicpc.net/problem/14889
14889번: 스타트와 링크
예제 2의 경우에 (1, 3, 6), (2, 4, 5)로 팀을 나누면 되고, 예제 3의 경우에는 (1, 2, 4, 5), (3, 6, 7, 8)로 팀을 나누면 된다.
www.acmicpc.net
1. dfs 조합으로 n / 2 명의 사람을 선택해 팀을 나눈다
2. select에 저장된 수가 0 혹은 1인지에 따라 팀을 구분할 수 있다
이에 맞춰서 스타트팀과 링크팀의 능력치를 구한다
3. 능력치의 차이값 중 최소값을 출력한다
import sys
input = sys.stdin.readline
def dfs(idx, cnt):
global ans
if cnt == n // 2:
start, link = 0, 0
for i in range(n):
for j in range(n):
if select[i] and select[j]:
start += a[i][j]
elif not select[i] and not select[j]:
link += a[i][j]
ans = min(ans, abs(start - link))
for i in range(idx, n):
if select[i]:
continue
select[i] = 1
dfs(i + 1, cnt + 1)
select[i] = 0
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
select = [0 for _ in range(n)]
ans = sys.maxsize
dfs(0, 0)
print(ans)

'백준' 카테고리의 다른 글
| 백준 14503 로봇 청소기 (파이썬) (0) | 2020.04.17 |
|---|---|
| 백준 14888 연산자 끼워넣기 (파이썬) (0) | 2020.04.17 |
| 백준 14890 경사로 (파이썬) (0) | 2020.04.16 |
| 백준 14891 톱니바퀴 (파이썬) (0) | 2020.04.16 |
| 백준 15683 감시 (파이썬) (0) | 2020.04.16 |
Comments