/// PhongVan cbhk64
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fo(i, l, r) for(int i = l; i <= r; i++)
#define foi(i, l, r) for(int i = l; i >= r; i--)
#define pii pair<int, int>
#define mx(x, y) max(x, y)
#define fi first
#define se second
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define ll long long
#define pob pop_back
#define all(x) x.begin(),x.end()
#define vii vector<int>
#define int long long
#define getbit(i, j) (i >> j) & 1
#define offbit(i, j) (1 << j) ^ i
#define onbit(i, j) (1 << j) | i
#define built(mask) __builtin_popcountll(mask)
#define len(s) (int)((s).size())
#define iii pair<int,pair<int, int> >
#define fillcharval(a) memset(a, -0x3f, sizeof(a));
#define fillchar(a,x) memset(a, x, sizeof (a))
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int N = 1e6 + 6;
const int mod = 1e9 + 7;
const int base = 31;
const int inf = 1e9;
void add(ll &x, const ll y){
x+= y;
if(x>=mod) x-= mod;
}
int n, m;
pii p[N];
int a[N];
bool cmp(pii a, pii b){
return a.fi > b.fi;
}
signed main()
{
faster
// in("task.inp");
// out("task.out");
cin >> n >> m;
fo(i, 1, n){
int x, y;
cin >> x >> y;
p[i] = {y, x};
}
fo(i, 1, m) cin >> a[i];
sort(p + 1, p + n + 1, cmp);
sort(a + 1, a + m + 1, greater<int>());
int ans = 1;
fo(i, 1, n){
if(p[i].se <= a[ans]) ans++;
if(ans == m + 1) break;
}
cout << ans - 1;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2552 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2552 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2552 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |