[Offer收割]编程练习赛46 register

Ended

Participants:142

Verdict:Accepted
Score:100 / 100
Submitted:2018-01-28 12:33:10

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <vector>
#include <functional>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <climits>
#include <list>
#include <numeric>
#include <stack>
using namespace std;
using ll = int64_t;
const ll mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
int lengthOfLIS(string& s) {
    vector<char> res;
    for(int i=0; i<s.size(); i++) {
        auto it = std::upper_bound(res.begin(), res.end(), s[i]);
        if(it==res.end()) res.push_back(s[i]);
        else *it = s[i];
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX