Submission #868195

#TimeUsernameProblemLanguageResultExecution timeMemory
868195MongHwaExhibition (JOI19_ho_t2)C++17
100 / 100
45 ms4764 KiB
#include <iostream> #include <algorithm> using namespace std; #define X first #define Y second pair<int, int> arr[100001]; int brr[100001]; bool cmp(pair<int, int>& a, pair<int, int>& b) { if(a.Y != b.Y) return a.Y > b.Y; return a.X > b.X; } int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; for(int i = 0; i < n; i++) cin >> arr[i].X >> arr[i].Y; for(int i = 0; i < m; i++) cin >> brr[i]; sort(arr, arr+n, cmp); sort(brr, brr+m); int ans = 0, pos = m-1; for(int i = 0; i < n; i++) if(pos >= 0 && arr[i].X <= brr[pos]) { ans++; pos--; } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...