https://www.acmicpc.net/problem/1377
1377번: 버블 소트
첫째 줄에 N이 주어진다. N은 500,000보다 작거나 같은 자연수이다. 둘째 줄부터 N개의 줄에 A[1]부터 A[N]까지 하나씩 주어진다. A에 들어있는 수는 1,000,000보다 작거나 같은 자연수 또는 0이다.
www.acmicpc.net
1
2
3
4
5
6
7
8
9
10
11
12
13
|
n = int(input())
a = []
for i in range(n):
a.append((int(input()), i))
s = sorted(a)
max = 0
for i in range(n):
if max < s[i][1]-i:
max = s[i][1]-i
print(max+1)
|
cs |
'백준' 카테고리의 다른 글
백준 11004번: K번째 수 (0) | 2023.02.06 |
---|---|
백준 1427번: 소트인사이드 (0) | 2023.02.05 |
백준 2750번: 수 정렬하기 (1) | 2023.02.04 |
백준 11286번: 절댓값 힙 (0) | 2023.02.04 |
백준 17298번: 오큰수 (0) | 2023.02.03 |