Submission #117707

#TimeUsernameProblemLanguageResultExecution timeMemory
117707JohnTitorExhibition (JOI19_ho_t2)C++11
100 / 100
49 ms4724 KiB
#include <bits/stdc++.h> using namespace std; #define FOR(i, j, k) for(int i=(j); i<=(k); i++) #define FFOR(i, j, k) for(int i=(j); i<(k); i++) #define DFOR(i, j, k) for(int i=(j); i>=(k); i--) #define bug(x) cerr<<#x<<" = "<<(x)<<'\n' #define pb push_back #define mp make_pair #define bit(s, i) (((s)>>(i))&1LL) #define mask(i) ((1LL<<(i))) #define builtin_popcount __builtin_popcountll #define __builtin_popcount __builtin_popcountll using ll=long long; using ld=long double; mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); const ld pi=acos(0)*2; template <typename T> inline void read(T &x){char c; bool nega=0; while((!isdigit(c=getchar()))&&(c!='-')); if(c=='-'){nega=1; c=getchar();} x=c-48; while(isdigit(c=getchar())) x=x*10+c-48; if(nega) x=-x;} template <typename T> inline void writep(T x){if(x>9) writep(x/10); putchar(x%10+48);} template <typename T> inline void write(T x){if(x<0){ putchar('-'); x=-x;} writep(x);} template <typename T> inline void writeln(T x){write(x); putchar('\n');} #define taskname "Exhibition" int n, m; class picture{ public: int s, v; void input(){ read(s); read(v); } }; deque <picture> q; deque <int> c; int main(){ #ifdef Aria if(fopen(taskname".in", "r")) freopen(taskname".in", "r", stdin); #endif // Aria read(n); read(m); q.resize(n); c.resize(m); for(auto &x: q) x.input(); for(auto &x: c) read(x); sort(c.begin(), c.end()); reverse(c.begin(), c.end()); sort(q.begin(), q.end(), [](picture A, picture B){ return (A.v>B.v)||(A.v==B.v&&A.s>B.s); }); int ans=0; while(!(c.empty()||q.empty())){ if(q.front().s>c.front()) q.pop_front(); else{ ans++; c.pop_front(); q.pop_front(); } } writeln(ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...