Submission #786954

#TimeUsernameProblemLanguageResultExecution timeMemory
786954makanhuliaExhibition (JOI19_ho_t2)C++17
0 / 100
1 ms340 KiB
/* Quick Note : * Jangan Mikir Lama - lama, sampahin dulu aja kalo OI * Always Try to reset */ #include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back #define debug(val) cerr << "The value of " << #val << " is = " << val << '\n'; typedef long double ld; typedef long long ll; typedef unsigned long long ull; const ld PI = 4*atan((ld)1); const ll mod = 1e9 + 7; const ll inf = 922337203685477; const ll nax = 1e5 + 5; ll n, m; pair<ll,ll> a[nax]; ll frame[nax]; bool cmp(pair<ll,ll> xx, pair<ll,ll> yy){ return xx.ss < yy.ss; } ll cek(ll val){ ll idx = m - val + 1; for(ll i = 1; i <= n; i++){ if(idx > m){ break; } else{ if(a[i].ff <= frame[idx]){ idx++; } } } return idx > m; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("test.in", "r", stdin); //freopen("test.out", "w", stdout); cin >> n >> m; for(ll i = 1; i <= n; i++){ cin >> a[i].ff >> a[i].ss; } for(ll i = 1; i <= m; i++) cin >> frame[i]; sort(frame + 1, frame + 1 + m); sort(a + 1, a + 1 + n, cmp); ll l = 0, r = m, ret = 0; while(l <= r){ ll mid = (l + r) / 2; if(cek(mid)){ ret = mid; l = mid + 1; } else r = mid - 1; } cout << ret << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...