이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define dbg(...) cerr << "LINE(" << __LINE__ << ") : [" << #__VA_ARGS__ << "] = [", debug(__VA_ARGS__), cerr << "]\n";
#define rep(i, b) for(int i = 0; i < (int)b; i++)
#define FOR(i, a, b) for(int i = (int)(a); i <= (int)(b); i++)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define vt vector
#define in(type, ...) type __VA_ARGS__; read(__VA_ARGS__);
template<class T> void read(T& t){ cin >> t; }
template<class T, class... H> void read(T& t, H&...h){ read(t); read(h...); }
template<class T> void read(vector<T>& t){ FOR(i, 0, sz(t) - 1) read(t[i]); }
template<class T> void write(const T t){ cout << t << ' ';}
template<class T> void print(const T t){ cout << t << '\n';}
template<class T,class...H> void print(const T& t, const H&...h){ cout << t; cout << " "; print(h...); }
template<class T> void debug(const T t) { cerr << t; }
template<class T,class...H> void debug(const T& t, const H&...h){
cerr << t;
if(sizeof...(h)) cerr << ", ";
debug(h...);
}
signed main() {
ios::sync_with_stdio(false); cin.tie(0);
int n, m; read(n, m);
vt<pair<int, int>> a(n);
vt<int> b(m);
FOR(i, 0, n - 1) read(a[i].second, a[i].first);
sort(all(a), [&](const pair<int, int>& x, const pair<int, int>& y){
return x.first < y.first || (x.first == y.first && x.second < y.second);
});
read(b);
sort(all(b));
int cnt = 0;
for(int i = n - 1; i >= 0; i--){
if(b[m - cnt - 1] >= a[i].second && m - cnt >= 1) cnt++;
}
print(cnt);
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... |