이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int long long
#define nl '\n'
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
mt19937 rng((unsigned)chrono::steady_clock::now().time_since_epoch().count());
const int mod = 1000000007, mod2 = 998244353;
// change this
const int N = 100005;
int n, m, frame[N], ans;
pair<int, int> pic[N];
signed main() {
io;
cin >> n >> m;
for (int i=0; i<n; i++) cin >> pic[i].first >> pic[i].second;
for (int i=0; i<m; i++) cin >> frame[i];
sort(frame, frame+m, greater<>());
priority_queue< pair<int, int> > pics;
for (int i=0; i<n; i++) pics.push({pic[i].second, pic[i].first}); // value, size
for (int i=0; i<m; i++) {
// try this frame
while (!pics.empty() && pics.top().second > frame[i]) pics.pop(); // too big
if (pics.empty()) break;
pics.pop(); // can add this
ans++;
}
cout << ans << nl;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |