Submission #365317

# Submission time Handle Problem Language Result Execution time Memory
365317 2021-02-11T12:41:39 Z l3nl3 Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 364 KB
#include <bits/stdc++.h>

#define int long long

using namespace std;

const int mxsz = 1234567;

int n, m, s[mxsz], v[mxsz], c[mxsz], an;
pair <int, int> a[mxsz];

bool cmp (int i, int j) {
    return i > j; 
}

bool comp (pair <int, int> i, pair <int, int> j) {
    if (i.first == j.first) {
        return i.second < j.second;
    }
    return i.first < j.first;
} 

int find (int x, int p) {
    while (p <= n+1 && a[p++].first > x);
    return p - 1;
}

signed main() {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        cin >> a[i].first >> a[i].second;
    }
    for (int i = 1; i <= m; i++) {
        cin >> c[i];
    }
    sort(a + 1, a + n + 1, comp);
    sort(c + 1, c + m + 1, cmp);
    int po = 1, pos = 1;
    for (int i = 1; i <= m; i++) {
        pos = find(c[i], po);
        po = pos;
        if (po == n+1) {
            break;
        } po++, an++;
    } 
    cout << an;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -