Submission #769310

#TimeUsernameProblemLanguageResultExecution timeMemory
769310NintsiChkhaidzeExhibition (JOI19_ho_t2)C++17
100 / 100
48 ms4476 KiB
#include <bits/stdc++.h> #define pb push_back #define ll long long #define s second #define f first #define left (node<<1),l,((l+r)>>1) #define right ((node<<1)|1),((l+r)>>1) + 1,r #define pii pair <int,int> using namespace std; const int N = 1e5 + 5; pii d[N]; int a[N]; bool cmp(pii x,pii y){ return ((x.s > y.s) || (x.s == y.s && x.f > y.f)); } signed main() { ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL); int n,m; cin>>n>>m; for (int i = 1; i <= n; i++) cin>>d[i].f>>d[i].s; for (int i = 1; i <= m; i++) cin>>a[i]; sort(d+1,d+n+1,cmp); sort(a+1,a+m+1); int r = m,ans=0; for (int i = 1; i <= n; i++){ if (r > 0 && a[r] >= d[i].f){ ++ans; --r; } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...