이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;
const int N = 1e6+50, mod = 1e9+7, K = 31;
int n,m;
int x,y;
int A[N];
int dp[N];
int res;
pair<int,int>P[N];
set<pair<int,int>>s;
inline bool check(int x){
int a = m-x+1;
for(int i = 1; i <= n; i++){
if(P[i].ss <= A[a]){
a++;
}
if(a == m+1) return true;
}
return false;
}
inline void test_case(){
cin >> n >> m;
for(int i = 1; i <= n; i++){
cin >> x >> y;
P[i] = {y,x};
}
sort(P+1,P+1+n);
for(int i = 1; i <= m; i++){
cin >> A[i];
}
sort(A+1,A+1+m);
int l = 1, r = min(n,m);
int res = 0;
while(l <= r){
int mid = (l+r)/2;
if(check(mid)){
res = mid;
l = mid+1;
} else {
r = mid-1;
}
}
cout << res << endl;
}
main(){
ios::sync_with_stdio(0);
int T = 1;
//cin >> T;
for(int i = 1; i <= T; i++){
test_case();
}
}
컴파일 시 표준 에러 (stderr) 메시지
joi2019_ho_t2.cpp:61:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
61 | main(){
| ^| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |