답안 #780578

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
780578 2023-07-12T10:24:44 Z borisAngelov Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 100005;

int n, m;

pair<int, int> a[maxn];
int b[maxn];

bool cmp(pair<int, int> p1, pair<int, int> p2)
{
    if (p1.second == p2.second)
    {
        return p1.first <= p2.first;
    }

    return p1.second > p2.second;
}

void fastIO()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main()
{
    fastIO();

    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 >> b[i];
    }

    sort(a + 1, a + n + 1, cmp);
    sort(b + 1, b + m + 1, greater<int>());

    int ans = 0;

    for (int i = 1; i <= n; ++i)
    {
        if (a[i].first <= b[ans + 1])
        {
            ++ans;
        }
    }

    cout << ans << endl;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -