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>
#define x first
#define y second
using namespace std;
typedef pair<int, int> p;
void f2(){
int n; cin >> n;
vector<p> v(n);
for(int i=0; i<n; i++) cin >> v[i].x >> v[i].y;
sort(v.begin(), v.end());
vector<int> lis;
for(auto &i : v){
int t = i.y;
auto it = lower_bound(lis.begin(), lis.end(), t);
if(it == lis.end()) lis.push_back(t);
else *it = t;
}
cout << lis.size();
}
int main(){
int n; cin >> n;
if(n == 2){
f2();
}
}
# | 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... |