Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main () {
- ifstream fin ("sclm2.in");
- ofstream fout ("sclm2.out");
- vector < int > deck;
- int n, x;
- for(fin >> n; n; n--) {
- fin >> x;
- auto it = upper_bound(deck.begin(), deck.end(), x);
- if(it == deck.end())
- deck.emplace_back(x);
- else
- *it = x;
- }
- fout << deck.size();
- }
Advertisement
Add Comment
Please, Sign In to add comment