# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
369339 | parsabahrami | Exhibition (JOI19_ho_t2) | C++17 | 81 ms | 4864 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Call my Name and Save me from The Dark
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
#define SZ(x) (int) x.size()
#define F first
#define S second
const int N = 1e5 + 10, MOD = 1e9 + 7;
int ret, n, m, S[N], V[N], id[N], C[N];
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) {
scanf("%d%d", &S[i], &V[i]), id[i] = i;
}
sort(id + 1, id + n + 1, [&] (int i, int j) { return V[i] != V[j] ? V[i] < V[j] : S[i] < S[j]; });
for (int i = 1; i <= m; i++)
scanf("%d", &C[i]);
sort(C + 1, C + m + 1);
for (int i = m, ptr = n; i >= 1; i--) {
if (ptr <= 0) break;
while (S[id[ptr]] > C[i]) ptr--;
if (ptr && S[id[ptr--]] <= C[i]) ret++;
}
printf("%d\n", ret);
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... |