Submission #743425

#TimeUsernameProblemLanguageResultExecution timeMemory
743425mickey080929Exhibition (JOI19_ho_t2)C++14
100 / 100
73 ms4368 KiB
#include <bits/stdc++.h>
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int n, m;
pii a[100010];
int c[100010];

int main() {
    scanf("%d %d", &n, &m);
    for (int i=1; i<=n; i++) {
        scanf("%d %d", &a[i].fi, &a[i].se);
    }
    sort(a+1, a+n+1, [&] (pii &u, pii &v) { return u.se == v.se ? u.fi < v.fi : u.se < v.se; });
    for (int i=1; i<=m; i++) {
        scanf("%d", &c[i]);
    }
    sort(c+1, c+m+1);
    int ans = 0;
    for (int i=n; i>=1; i--) {
        int idx = lower_bound(c+1, c+m+1, a[i].fi) - c;
        if (idx > m) continue;
        int p = min(ans, m-idx) + 1;
        ans = max(ans, p);
    }
    printf("%d", ans);
}

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d %d", &a[i].fi, &a[i].se);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%d", &c[i]);
      |         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...