1027번: 고층 건물 (acmicpc.net)

##




##
import sys
input = sys.stdin.readline
#N = input()
l = list(map(int,map(lambda x:x.rstrip().replace('\x1a','') ,input().split())))

def grad(a,b,c,d):
    if c==d: return 0
    else: return (a-b)/(c-d)

m = []
for i in range(len(l)):
    m_i = []
    for j in range(len(l)):
        m_i.append(grad(l[i],l[j],i,j))
    m += [m_i]

max_count = 0
for i in range(len(m)):
    # i번 빌딩을 잡고 양쪽의 빌딩 볼수있는지 여부 판단
    count = 0
    see= []
    idx_see = [] #test

    # count 하되 이전에 들어간 기울기보다 작거나 같다면 버린다.(큰것만 더함)
    for j in range(i+1,len(m)): #우측
        if len(see) == 0 or m[i][j] > see[-1]:
            see += [m[i][j]]
                #idx_see += [j] # test

    count += len(see)
    see = []
    for j in range(i-1,-1,-1): #좌측
        if len(see) == 0 or m[i][j] > see[-1]:
            see += [m[i][j]]
                #idx_see += [j] #test

    count += len(see)
    max_count = max(max_count,count)
    #print(i,idx_see,count)
print(max_count)


ㅜㅜ



import sys
input = sys.stdin.readline
N = int(input())
l = list(map(int,map(lambda x:x.rstrip().replace('\x1a','') ,input().split())))

def ccw(a, b, c): # CCW 이용하여 위치관계 파악
    return (a[0] * b[1] + b[0] * c[1] + c[0] * a[1]) - (a[1] * b[0] + b[1] * c[0] + c[1] * a[0])

def solve():
    if N < 3:
        print(N-1)
        return None
   
    ans = 0
   
    for i in range(N):
        res = []
        # 오른쪽
        res.append(i+1) # 바로 오른쪽에 있는건 보임
        for j in range(i+2, N):
            if ccw([i,l[i]], [res[-1],l[res[-1]]], [j,l[j]]) > 0:
                res.append(j)
       
        # 왼쪽 역순
        for j in range(i-1, -1, -1):
            if ccw([i,l[i]], [res[-1],l[res[-1]]], [j,l[j]]) < 0:
                res.append(j)
       
        ans = max(ans,len(res))
    print(ans)
    return None

solve()


ㅠㅠ
안되네
남에거 보고 해도 잘 안되네
왼쪽 역순 부분이 틀린듯 싶은데
애초에 역순을 했으면 ccw가 +아닌가
오른쪽은 ccw가 +인게 맞고

쉬운거 하나 어려운거 하나 풀어야지
어려운거 먼저잡으니까 1일 1문이 안되네
컨디션도 안좋다



import sys
input = sys.stdin.readline
N = int(input())
l = list(map(int,map(lambda x:x.rstrip().replace('\x1a','') ,input().split())))

def ccw(a, b, c): # CCW 이용하여 위치관계 파악
    return (a[0] * b[1] + b[0] * c[1] + c[0] * a[1]) - (a[1] * b[0] + b[1] * c[0] + c[1] * a[0])

def solve():
    ans = 0
    if N < 3:
        print(N-1)
        return None
    for i in range(N):
        res = []

        # 오른쪽
        if i < N-1:     ######## 이 조건 필요
            res.append(i+1) # 바로 오른쪽에 있는건 보임
            for j in range(i+2, N):
                if ccw([i,l[i]], [res[-1],l[res[-1]]], [j,l[j]]) > 0:
                    res.append(j)
       
        # 왼쪽 역순
        if 0 < i:       ######## 이 조건 필요
            res.append(i-1)
            for j in range(i-1, -1, -1):
                if ccw([i,l[i]], [res[-1],l[res[-1]]], [j,l[j]]) < 0:
                    res.append(j)
       
        ans = max(ans,len(res))
    print(ans)
    return None

solve()

일단 다른거 참고해서 제출은 했는데
왼쪽 역순으로 보면서 ccw따지면 부등호가 반대 아닌가
형태가 오른쪽이랑 똑같이 될것 같은데
선대칭한 형태로...