/**
__author__ : FireGhost
problems_ID: JOI19_ho_t2
*/
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
const int N = 1e5 + 3;
const int MOD = 1e9 + 7;
struct item {
int s, v;
bool operator < (const item &o) const {
return v < o.v;
}
};
int n, m, c[N];
item a[N];
void solve() {
cin >> n >> m;
for (int i = 1; i <= n; ++i)
cin >> a[i].s >> a[i].v;
for (int i = 1; i <= m; ++i)
cin >> c[i];
sort(a + 1, a + n + 1);
sort(c + 1, c + n + 1);
int j = m, ans = 0;
for (int i = n; i > 0; --i) {
if (a[i].s > c[j]) continue;
--j, ++ans;
}
cout << ans;
}
int main() {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
int t = 1;
while (t--)
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |