# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
537376 | kawaii | Exhibition (JOI19_ho_t2) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int t, n, m, mod = 1e9 + 7;
mt19937_64 rng;
struct point{
int s, h;
};
bool operator < (point a, point b){
return a.h < b.h;
}
point a[1000005];
int b[1000005];
void solve(){
int crr = 1;
for(int i = n; i >= 1; i--){
if(crr <= m && a[i].s <= b[m - cur + 1]){
crr++;
if(crr == m + 1) break;
}
}
cout << crr <<" ";
}
signed main(){
ios_base::sync_with_stdio(NULL); cin.tie(nullptr); cout.tie(nullptr);
rng.seed((int)main ^ time(0));
#ifdef Kawaii
auto starttime = chrono::high_resolution_clock::now();
#endif
cin >> n >> m;
for(int i = 1; i <= n; i++) cin >> a[i].s >> a[i].h;
for(int i = 1; i <= m; i++) cin >> b[i];
sort(b + 1, b + m + 1);
sort(a + 1, a + n + 1);
solve();
#ifdef Kawaii
auto endtime = chrono::high_resolution_clock::now();
auto duration = chrono::duration_cast<chrono::milliseconds>(endtime - starttime).count();
cout << "\n=====" << "\nUsed: " << duration << " ms\n";
#endif
}