0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

#1034. 【中山A组 2018.8.19 T1】列车调度

https://sjzezoj.com/submission/37395
This commit is contained in:
Baoshuo Ren 2021-09-30 18:08:10 +08:00 committed by Baoshuo Ren
parent 6c119e64e1
commit 51b7412d56
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

22
S2OJ/1034/1034.cpp Normal file
View 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;
}