제출 #1349921

#제출 시각아이디문제언어결과실행 시간메모리
1349921sameerExhibition (JOI19_ho_t2)C++20
100 / 100
29 ms2784 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
ll i, j, k, n, m, c[100007]; pair<ll, ll> p[100007];

bool cmp(pair<ll, ll> x, pair<ll, ll> y){
 if(x.second == y.second) return x.first < y.first;
 else return x.second < y.second;
}

void run(){
 cin >> n >> m;
 for( i = 1; i <= n; i++) cin >> p[i].first >> p[i].second;
 for( i = 1; i <= m; i++) cin >> c[i];
 sort(c+1, c+m+1);
 sort(p+1, p+n+1, cmp);
 i = n; j = m;
 while(j >= 1){
 while(i >= 1 && c[j] < p[i].first) i--;
 if(i < 1) break;
 i--; j--;
 } cout << m-j << '\n';
}

int main(){
 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 // int tt; cin >> tt; while(tt--)
 run();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...