Submission #878728

# Submission time Handle Problem Language Result Execution time Memory
878728 2023-11-25T06:34:09 Z frostray8653 Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 2396 KB
#include <bits/stdc++.h>
#define int long long
#define IO ios::sync_with_stdio(0), cin.tie(0)
#define FOR(i, a, b) for (int i = a, I = b; i <= I; i++)
using namespace std;
using pii = pair<int, int>;
void dbg() {;}
template<class T, class ...U>
void dbg(T a, U ...b) { cout << a << " "; dbg(b...); }
void ent() { cout << "\n"; }

const int N = 100005;
pii a[N];
int c[N];

signed main() {
    IO;

    int n, m;
    cin >> n >> m;
    FOR(i, 0, n - 1) cin >> a[i].first >> a[i].second;
    FOR(i, 0, m - 1) cin >> c[i];
    sort(a, a + n, greater<pii>());
    sort(c, c + m, greater<int>());
    vector<int> tmp;
    int id = 0;
    FOR(i, 0, n - 1) {
        int l = -1, r = tmp.size();
        while (l + 1 < r) {
            int mid = (l + r) >> 1;
            if (a[i].second > tmp[mid])
                r = mid;
            else
                l = mid;
        }
        if (r == tmp.size()) {
            if (r < m && a[i].first <= c[r])
                tmp.push_back(a[i].second);
        } else {
            if (r < m && a[i].first <= c[r])
                tmp[r] = a[i].second;
        }
    }
    cout << tmp.size() << "\n";

    return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:36:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         if (r == tmp.size()) {
      |             ~~^~~~~~~~~~~~~
joi2019_ho_t2.cpp:26:9: warning: unused variable 'id' [-Wunused-variable]
   26 |     int id = 0;
      |         ^~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Incorrect 0 ms 2396 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Incorrect 0 ms 2396 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Incorrect 0 ms 2396 KB Output isn't correct
6 Halted 0 ms 0 KB -