标签:click size div pac begin ble end || space
思路:
去过前面的数字小于当前数字,当前数字直接加入
否则 找到数组里面第一个>它的数字替换上
1 #include<bits/stdc++.h> 2 3 using namespace std; 4 int n,a; 5 vector<int> ve; 6 int main() { 7 ios::sync_with_stdio(0); 8 cin >> n; 9 for(int i = 0; i < n; i++) { 10 cin >> a; 11 if(!i || ve.back() < a) 12 ve.push_back(a); 13 else *lower_bound(ve.begin(),ve.end(),a) = a; 14 } 15 cout << ve.size(); 16 return 0; 17 18 }
标签:click size div pac begin ble end || space
原文地址:https://www.cnblogs.com/xcfxcf/p/13338699.html