이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
#define INF 1000000000000000
#define lchild(i) (i*2 + 1)
#define rchild(i) (i*2 + 2)
#define mid(l, u) ((l+u)/2)
#define x(p) p.first
#define y(p) p.second
#define MOD 998244353
using namespace std;
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, m;
cin>>n>>m;
pair<int, int> p[n];
for(int i = 0;i<n;i++) cin>>p[i].second>>p[i].first;
sort(p, p+n);
vector<int> fs;
for(int i = 0;i<m;i++){
int temp;
cin>>temp;
fs.push_back(temp);
}
sort(fs.begin(), fs.end());
int maxi = 0;
int ans = 0;
for(int i = n-1;i>=0;i--){
//cout<<p[i].first<<" "<<p[i].second<<" "<<Ca
auto it = lower_bound(fs.begin(), fs.end(), p[i].second);
int cant = it - fs.begin();
int can = m - cant;
int curr = min(maxi+1, can);
maxi = max(maxi, curr);
ans = max(ans, curr);
}
cout<<ans<<"\n";
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |