Submission #540779

#TimeUsernameProblemLanguageResultExecution timeMemory
540779status_codingExhibition (JOI19_ho_t2)C++14
100 / 100
152 ms4444 KiB
#include <bits/stdc++.h> using namespace std; struct pos { int val, s; bool operator<(pos b) { if(val != b.val) return val<b.val; return s < b.s; } }; int n,m; pos v[100005]; int s[100005]; int st, dr, mij, last; bool ok(int k) { int j=m-k+1; for(int i=1;i<=n;i++) { if(j<=m && v[i].s <= s[j]) j++; } return (j == m+1); } int main() { cin>>n>>m; for(int i=1;i<=n;i++) cin>>v[i].s>>v[i].val; sort(v+1, v+n+1); for(int i=1;i<=m;i++) cin>>s[i]; sort(s+1, s+m+1); st=1, dr=n; while(st <= dr) { mij = (st+dr)/2; if(ok(mij)) { last=mij; st=mij+1; } else dr=mij-1; } cout<<last; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...