Submission #703682

# Submission time Handle Problem Language Result Execution time Memory
703682 2023-02-28T06:15:32 Z qwe1rt1yuiop1 Exhibition (JOI19_ho_t2) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int, int> pii;

inline void solve()
{
    int n, m;
    cin >> n >> m;
    vector<pii> v(n);
    for (pii &i : v)
        cin >> i.second >> i.first;
    vector<int> f(m);
    for (auto &i : f)
        cin >> i;
    sort(v.begin(), v.end()), sort(f.begin(), f.end());
    reverse(v.begin(), v.end()), reverse(f.begin(), f.end());

    // cout << '\n';
    // for (auto i : v)
    //     cout << i.first << ' ' << i.second << '\n';
    // for (int i : f)
    //     cout << i << ' ';
    // cout << '\n';

    int mx = 0, cur = 0;
    for (pii i : v)
    {
        while (cur >= m || cur >= 0 && f[cur] < i.second)
            --cur;
        mx = max(mx, ++cur);
        // cerr << cur << ' ';
    }
    cout << min(mx, m) << '\n';
}

signed main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    solve();

    return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'void solve()':
joi2019_ho_t2.cpp:29:37: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   29 |         while (cur >= m || cur >= 0 && f[cur] < i.second)
      |                            ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -