0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-12 17:46:28 +00:00
OI-codes/S2OJ/1034/1034.cpp

23 lines
364 B
C++
Raw Normal View History

#include <bits/stdc++.h>
using namespace std;
int n, l, x, ans;
set<int> s;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> x;
auto it = s.upper_bound(x);
if (it == s.end()) {
ans++;
} else {
s.erase(*it);
}
s.insert(x);
}
cout << ans << endl;
return 0;
}