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 int long long
#define fi first
#define se second
#define keish ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
int n, m;
signed main(){
keish;
cin >> n >> m;
vector<pair<int ,int>> a(n);
for(int i = 0; i < n; i++) cin >> a[i].se >> a[i].fi;
vector<int> c(m);
for(int i = 0; i < n; i++) cin >> c[i];
sort(a.begin(), a.end());
sort(c.begin(), c.end());
int prv = 0, ans = 0;
for(int i = 0; i < n; i++){
if(prv < a[i].se){
prv = a[i].se;
ans++;
}
}
cout << ans << '\n';
}
// 1 5
// 5 3
// 20 10
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |