Submission #792094

#TimeUsernameProblemLanguageResultExecution timeMemory
792094BoomydayExhibition (JOI19_ho_t2)C++17
100 / 100
47 ms6620 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using db = double; using str = string; using ii = pair<int,int>; using pl = pair<ll,ll>; using pd = pair<db,db>; using vi = vector<int>; using vb = vector<bool>; using vl = vector<ll>; using vd = vector<db>; using vs = vector<str>; using vii = vector<ii>; using vpl = vector<pl>; using vpd = vector<pd>; #define tcT template<class T #define tcTU tcT, class U tcT> using V = vector<T>; tcT, size_t SZ> using AR = array<T,SZ>; tcT> using PR = pair<T,T>; // pairs #define mp make_pair #define f first #define s second #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (int i = (a)-1; i >= (b); --i) #define R0F(i,a) ROF(i,a,0) #define trav(a,x) for (auto& a: x) #define len(x) int((x).size()) #define bg(x) begin(x) #define all(x) bg(x), end(x) #define rall(x) rbegin(x), rend(x) #define sor(x) sort(all(x)) #define rsz resize #define ins insert #define ft front() #define bk back() #define pb push_back #define eb emplace_back #define pf push_front const int MOD = 1e9+7; // 998244353; const int MX = 2e5+5; const ll INF = 1e18; // not too close to LLONG_MAX const ld PI = acos((ld)-1); const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem!! vector<pair<ll, ll>> pics; vector<ll> frames; int main(){ std::ios::sync_with_stdio(false); cin.tie(NULL); ll N, M; cin >> N >> M; F0R(_, N){ ll s, v; cin >> s >> v; pics.pb({s,v}); } F0R(_, M){ ll c; cin >> c; frames.pb(c); } sort(all(frames), [](ll& n1, ll& n2)->bool{return n1 > n2;}); // bigger is better sort(all(pics), [](pair<ll,ll>&p1, pair<ll,ll>&p2)->bool{ if (p1.s == p2.s) { return p1.f > p2.f;} return p1.s > p2.s; }); //trav(i, pics) cout << i.f << " " << i.s << " "; //cout << endl; ll cur_frame = 0; trav(pic, pics){ if (pic.f <= frames[cur_frame]){ cur_frame++; } } cout << min(N,min(cur_frame,M)) << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...