This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (int)a.size()
#define pll pair<ll, ll>
#define all(x) (x).begin(), (x).end()
const ll inf = 1e10;
int main() {
ll n, d; cin >> n >> d;
vector<ll> v(n+1, inf);
v[0]=-1*inf;
for(ll i=0; i<n; i++){
ll x; cin >> x;
ll k=upper_bound(all(v), x)-v.begin();
if(v[k-1]<x && x<v[k]) v[k]=x;
}
ll c=-1;
for(auto& u : v) if(u<inf) c++;
cout << c << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |