-
Codeforces Round 886 (Div. 4)코드포스 2023. 11. 27. 14:47
Dashboard - Codeforces Round 886 (Div. 4) - Codeforces
codeforces.com
D
An arrangement that always minimizes the absolute difference between adjacent pairs is the array in sorted order.
G
평면상의 직선 위에 있는 서로 다른 점의 개수를 세는 방법
H
병사들을 노드로, 병사간의 거리를 directed edge의 weight로 모델링한다. 이때 핵심은 양방향 간선을 모두 포함하여 임의의 노드에서 시작하여도 상관 없게 만드는 것! 그 후 dfs를 이용하여 모든 병사간의 거리를 결정한다. 마지막으로 모든 조건이 충족되는지 확인하면 된다.
6 5
1 2 2
2 3 4
4 2 -6
5 4 4
3 5 100'코드포스' 카테고리의 다른 글
Codeforces Round 898 (Div. 4) (1) 2023.11.27 Codeforces Round 898 (Div. 4) (1) 2023.11.27 Codeforces Round 871 (Div. 4) (2) 2023.11.24 Codeforces Round 859 (Div. 4) (1) 2023.11.23 Codeforces Round 784 (Div. 4) (0) 2023.11.15