# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1234525 | Bui_Quoc_Cuong | Exhibition (JOI19_ho_t2) | C++20 | 0 ms | 324 KiB |
#include <bits/stdc++.h>
#define ll long long
#define FOR(i, a, b) for(int i = a; i <= (int)b; i++)
#define FORD(i, a, b) for(int i = a; i >= (int)b; i--)
#define ALL(A) A.begin(), A.end()
using namespace std;
const int maxn = 100005;
int n, m;
int c[maxn], v[maxn], s[maxn], ID[maxn];
int main(){
cin.tie(nullptr) -> sync_with_stdio(false);
#define taskname "kieuoanh"
if(fopen(taskname".inp", "r")){
freopen(taskname".inp", "r", stdin); freopen(taskname".out", "w", stdout);
}
cin >> n >> m;
FOR(i, 1, n) cin >> s[i] >> v[i];
FOR(i, 1, m) cin >> c[i];
FOR(i, 1, n) ID[i] = i;
sort(ID + 1, ID + 1 + n, [&](int a, int b){
if(v[a] == v[b]) return s[a] < s[b];
return v[a] < v[b];
});
sort(c + 1, c + 1 + m);
int ans = 0;
int it = m;
FORD(id, n, 1){
int i = ID[id];
if(it - 1 >= 1 && s[i] <= c[it - 1]) ans++;
}
cout << ans;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |