이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
using namespace std;
#define for_(i, s, e) for (int i = s; i < (int) e; i++)
#define for__(i, s, e) for (ll i = s; i < e; i++)
typedef long long ll;
typedef vector<int> vi;
typedef array<int, 2> ii;
#define endl '\n'
namespace speedy_io {
int read_nonneg() {
int c;
while ((c = getchar_unlocked()) < '0' || c > '9');
int v = c - '0';
while ((c = getchar_unlocked()) >= '0' && c <= '9') {
v = (v << 3) + (v << 1) + (c - '0');
}
return v;
}
const int max_ll_size = 20;
void put_nonneg(ll n) {
int i = max_ll_size;
char output_buffer[max_ll_size];
do {
output_buffer[--i] = (n % 10) + '0';
n /= 10;
} while (n);
do {
putchar_unlocked(output_buffer[i]);
} while (++i < max_ll_size);
}
}
using namespace speedy_io;
int main() {
#ifdef mlocal
freopen("test.in", "r", stdin);
#endif
// ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m; cin >> n >> m;
ii pic[n];
int sz[m];
for_(i, 0, n) pic[i][1] = read_nonneg(), pic[i][0] = read_nonneg();
sort(pic, pic+n, greater<>());
for_(i, 0, m) sz[i] = read_nonneg();
sort(sz, sz+m, greater<>());
int ans = 0, pt = 0;
for_(i, 0, m) {
while (pt < n and sz[i] < pic[pt][1]) pt++;
if (pt < n) {
pt++;
ans++;
} else break;
}
cout << ans << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |