-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaekJoon_11497.py
More file actions
52 lines (42 loc) · 1.22 KB
/
BaekJoon_11497.py
File metadata and controls
52 lines (42 loc) · 1.22 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 통나무 뛰어넘기 11497
#https://www.acmicpc.net/problem/11497
from sys import stdin
t = int(stdin.readline())
for _ in range(t):
n = int(stdin.readline())
heights = [int(x) for x in stdin.readline().split()]
heights.sort()
max_level = 0
for i in range(2, n):
max_level = max(max_level, abs(heights[i] - heights[i - 2]))
print(max_level)
# from collections import deque
# N = int(input())
# last = []
# for _ in range(N):
# leng = int(input())
# sample = [*map(int,input().split())]
# sample.sort(reverse=True)
# sample = deque(sample)
# answer = deque()
# #deque 이용해 정규분포 만들기
# i = 0
# while sample :
# current = sample.popleft()
# if i == 0 :
# answer.append(current)
# elif i%2 == 1 :
# answer.append(current)
# else:
# answer.appendleft(current)
# i+=1
# #정규분포 중 최댓값 출력
# max_num = 0
# for k in range(1,leng):
# if k == leng-1 :
# max_num = max(max_num,answer[-1]-answer[0])
# else :
# max_num = max(max_num,answer[k]-answer[k-1])
# last.append(max_num)
# for i in last :
# print(i)