#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <ll , ll> pll;
typedef pair <int , int> pii;
#define fi first
#define se second
//#define int ll
const int intf = 2e9 , maxn = 1e5 + 5;
const ll inf = 2e18 , mod = 1e9 + 7;
void solve(){
int n , m; cin >> n >> m;
vector <pii> a(n);
vector <int> r(m);
for (auto &x : a){
cin >> x.se >> x.fi;
}
sort(a.begin() , a.end());
for (auto &x : r){
cin >> x;
}
sort(r.begin() , r.end());
int i = 0 , j = 0 , ans = 0;
while(i < n && j < m){
if (a[i].se <= r[j]){
i++;
ans++;
}
j++;
}
cout << ans;
}
signed main() {
//freopen("input.txt" , "r" , stdin);
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(20);
int t = 1; //cin >> t;
while(t-->0){
solve();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
360 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
360 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
360 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |