Submission #519573

#TimeUsernameProblemLanguageResultExecution timeMemory
519573JomnoiExhibition (JOI19_ho_t2)C++17
100 / 100
60 ms4996 KiB
#include <bits/stdc++.h> #define DEBUG 0 using namespace std; class P { public : int s, v; P() : s(), v() {} P(int S, int V) : s(S), v(V) {} bool operator<(const P &o) const { return make_pair(v, s) < make_pair(o.v, o.s); } }; int main() { cin.tie(0)->sync_with_stdio(0); int n, m; cin >> n >> m; vector <P> p; vector <int> C; for(int i = 1; i <= n; i++) { int s, v; cin >> s >> v; p.push_back(P(s, v)); } for(int i = 1; i <= m; i++) { int c; cin >> c; C.push_back(c); } sort(p.begin(), p.end()); sort(C.begin(), C.end()); int ans = 0; for(int i = n - 1, j = m - 1; i >= 0 and j >= 0; i--) { if(p[i].s <= C[j]) { ans++; j--; } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...