개발자 톡

연습문제 톡 징검다리

lis 알고리즘 풀이 c++

등록일
2024-10-03 17:57:19
조회수
12
작성자
jshch13

#include<iostream>



using namespace std;

int lis[3004];

int len;

int n;

int temp;

int main(int argc, char** argv)

{

  cin >> n;


  for(int i = 0; i < n; i++)

    {

      cin >> temp;

      auto lowerPos = lower_bound(lis, lis + len, temp);

      if(*lowerPos == 0) len++;

      *lowerPos = temp;

    }


  cout << len;

  return 0;

}

#징검다리

이 카테고리의 톡 더보기