Submission #1095907

#TimeUsernameProblemLanguageResultExecution timeMemory
1095907PhuocExhibition (JOI19_ho_t2)C++14
100 / 100
41 ms5724 KiB
#include <bits/stdc++.h> #include <ctime> #include <algorithm> #include <random> using namespace std; #define el '\n' #define ll long long #define fi first #define se second #define BIT(mask, i) (((mask) >> (i)) & 1) #define MASK(i) (1LL << (i)) const ll INF = (ll)1e18 + 9; const int oo = (int)1e9 + 7; const ll MOD = (ll)1e9 + 7; template <class T1, class T2> bool minimize(T1 &a, T2 b) { if(a > b) {a = b; return true;} return false; } template <class T1, class T2> bool maximize(T1 &a, T2 b) { if(a < b) {a = b; return true;} return false; } template <class T1, class T2> void add (T1 &a, T2 b) { a += b; if (a >= MOD) a -= MOD; } const int N = 100100; int n, m; pair <ll, ll> pics [N]; ll frames[N]; void init (void) { cin >> n >> m; for (int i = 1; i <= n; i++) cin >> pics[i].fi >> pics[i].se; for (int i = 1; i <= m; i++) cin >> frames[i]; } int f[N]; bool cmp (pair <ll, ll> a, pair <ll, ll> b) { if(a.se != b.se) return a.se < b.se; else return a.fi < b.fi; } void solve (void) { sort (pics + 1, pics + n + 1, cmp); int ans = 0; sort(frames + 1, frames + m + 1); int j = n; for (int i = m; i >= 1; i--) { while(frames[i] < pics[j].fi && j > 0) j--; // if(frames[i] >= pics[j].fi) { // ans++; // } if(j < 1) { cout << ans << el; return; } j--; ans++; } cout << ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define test "test" // freopen (test".inp", "r", stdin); // freopen (test".out", "w", stdout); srand(time(0)); int ntest = 1; // cin >> ntest; while(ntest--) { init(); solve(); } return 0; } // chim chim chim orz orz orz
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...