mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2025-02-17 14:06:47 +00:00
parent
6c119e64e1
commit
51b7412d56
22
S2OJ/1034/1034.cpp
Normal file
22
S2OJ/1034/1034.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#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;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user