This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>
/*
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,bmi2,fma,popcnt")
*/
#ifdef lisie_bimbi
#define debug(x) cout << #x << " : " << x << endl;
#else
#define debug(x) ;
#define endl '\n'
#endif
//#define int long long
#define inf 1000000000
#define double long double
typedef long long ll;
signed main(){
#ifdef lisie_bimbi
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#else
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
#endif
int n, m;
cin >> n >> m;
vector<int> c(m);
vector<pair<int, int>> a(n);
for(int i = 0 ; i < n; i++){
cin >> a[i].second >> a[i].first;
}
for(int i = 0; i < m; i++){
cin >> c[i];
}
std::sort(a.begin(), a.end());
std::sort(c.begin(), c.end());
std::reverse(a.begin(), a.end());
std::reverse(c.begin(), c.end());
int a1 = 0;
int c1 = 0;
int ans = 0;
while((a1 != n) && (c1 != m)){
if(a[a1].second <= c[c1]){
ans++;
a1++;
c1++;
}else{
a1++;
}
}
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |