run2ai / algorithm-taek

0 stars 0 forks source link

버블 소트 프로그램1 #17

Closed Blzae97 closed 3 months ago

Blzae97 commented 3 months ago

시간 제한: 2초 난이도: 골드Ⅱ 백준 온라인 저지: 1377번 https://www.acmicpc.net/problem/1377

teang1995 commented 3 months ago
# https://www.acmicpc.net/problem/1377

import sys
input = sys.stdin.readline

n = int(input())
arr = []
for i in range(n):
    arr.append( (int(input()), i) )

sorted_arr = sorted(arr) 
print(sorted_arr)
answer = [] 

for i in range(n):
    answer.append(sorted_arr[i][1] - arr[i][1])

print(max(answer) + 1)