Submission #1128278

#TimeUsernameProblemLanguageResultExecution timeMemory
1128278Haciyev12Exhibition (JOI19_ho_t2)C++20
0 / 100
0 ms328 KiB
#include "bits/stdc++.h" #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define pb push_back #define in insert #define F first #define S second #define vll vector<ll> #define all(v) v.begin(),v.end() #define endl '\n' #define pii pair<ll,ll> #define yes cout << "YES" << endl; #define no cout << "NO" << endl; using namespace std; const ll INF = 1e18, mod = 1e9 + 7, N = 2e5 + 5; ll gcd(ll a, ll b) { if (b == 0) { return a; } return gcd(b, a % b); } ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; } void solve() { ll n, m; cin >> n >> m; vector<pii> v; ll x, y; for (int i = 0; i < n; i++) { cin >> x >> y; v.pb({y, x}); } vector<ll> f; ll r; for (int i = 0; i < m; i++) { cin >> r; f.pb(r); } sort(all(f)); sort(all(v)); ll cnt = 0; vector<ll>used(n,0); vector<ll>used1(m,0); ll in = -1; ll j =0; /*4 6 10 4*/ /* 10 20 5 1 3 5 */ for (ll i = 0; i < n; i++) { while (j < f.size()) { if(f[j] >= v[i].S){ cnt++; j++; break; } j++; } if(j == f.size())break; } cout << cnt << endl; } int main() { fast; ll t = 1; // cin >> t; while (t--) { solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...