제출 #1269118

#제출 시각아이디문제언어결과실행 시간메모리
1269118WH8Exhibition (JOI19_ho_t2)C++20
100 / 100
36 ms3776 KiB
#include <bits/stdc++.h> using namespace std; #define iloop(x, n) for (long long i = x; i < n; ++i) #define jloop(x, n) for (long long j = x; j < n; ++j) #define kloop(x, n) for (long long k = x; k < n; ++k) #define dloop(x, n) for (long long d = x; d >= n; --d) #define ll long long #define pll pair<long long, long long> #define pii pair<int, int> #define vi vector<long long> #define mp make_pair #define pb push_back #define fst first #define snd second #define int long long #define debug(x) cout << #x << ": " << x << endl #define FASTIO \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); int32_t main(){ FASTIO int n, m; cin >> n >> m; vector<pll> v; vi f; iloop(0, n){ int s, val; cin >> s >> val; v.pb({val, s}); } sort(v.begin(), v.end(), [](pll a, pll b){ if (a.fst < b.fst) return false; else if (a.fst == b.fst) return a.snd > b.snd; else return true; }); //for (auto it : v) cout << it.fst << " " << it.snd << " | "; //cout << endl; iloop(0, m){ int s; cin >> s; f.pb(s); } sort(f.begin(), f.end(), greater<int>()); int pos = 0; int cnt = 0; iloop(0, m){ while (pos < n and v[pos].snd > f[i]){ pos++; } if (pos == n) break; cnt++; pos++; } cout << cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...