Submission #1023689

#TimeUsernameProblemLanguageResultExecution timeMemory
1023689trandangquangExhibition (JOI19_ho_t2)C++14
100 / 100
93 ms5736 KiB
#include <bits/stdc++.h> using namespace std; using ll=long long; int main(){ int N, M; cin >> N >> M; vector<pair<int, int>> SV; for(int i=0;i<N;i++){ int s, v; cin >> s >> v; SV.push_back({v, s}); } vector<ll> C(M); for(int i=0;i<M;i++){ cin >> C[i]; } sort(SV.begin(), SV.end()); vector<ll> S(N); for(int i=0;i<N;i++){ S[i]=SV[i].second; } sort(C.begin(), C.end()); int now=M-1; int ans=0; for(int i=N-1;i>-1;i--){ if(S[i]<=C[now]){ ans++; now--; } if(now<0){ break; } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...