Submission #1112087

# Submission time Handle Problem Language Result Execution time Memory
1112087 2024-11-13T16:17:15 Z eueka Exhibition (JOI19_ho_t2) C++14
0 / 100
1 ms 2556 KB
#include <bits/stdc++.h>
#define NAME "BWTREE"
#define ll long long
#define ii pair<ll, ll>
#define mo(i, a, b) for (int i = a; i <= b; i++)
#define me(i, a, b) for (int i = a; i >= b; i--)
#define bit(mask, i) ((mask >> i) & 1)
const ll N = 1e6 + 5;
const ll mod = 1e9 + 7;
const ll base = 31;
const ll inf = 1e18;
using namespace std;
ii a[N];
ll c[N], n, m;
ll check(ll k){
    ll j = m - k;
    mo(i, 1, n){
        if(j == m) break;
        if(a[i].second <= c[j]) j++;
    }
    return j == m;
}
int main()
{
    ///freopen(NAME".inp", "r", stdin);
    ///freopen(NAME".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    mo(i, 1, n) cin >> a[i].second >> a[i].first;
    mo(i, 1, m) cin >> c[i];
    sort(a + 1, a + n + 1);
    sort(c + 1, c + m + 1);
    ll l = 0, r = min(n, m);
    while(r - l > 1){
        ll mid = l + r >> 1;
        if(check(mid)) l = mid;
        else r = mid;
    }
    cout << l + 1 << "\n";
    return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:37:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   37 |         ll mid = l + r >> 1;
      |                  ~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2556 KB Output isn't correct
2 Halted 0 ms 0 KB -