Submission #127596

#TimeUsernameProblemLanguageResultExecution timeMemory
127596arnold518Exhibition (JOI19_ho_t2)C++14
100 / 100
94 ms4984 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 1e5;

int N, M;
pii V[MAXN+10];
int S[MAXN+10], C[MAXN+10];
int ans;

int main()
{
    int i, j;

    scanf("%d%d", &N, &M);
    for(i=1; i<=N; i++) scanf("%d%d", &V[i].second, &V[i].first);
    for(i=1; i<=M; i++) scanf("%d", &C[i]);

    sort(V+1, V+N+1);
    sort(C+1, C+M+1);
    for(i=1; i<=N; i++) S[i]=V[i].second;

    for(i=N, j=M; i>=1 && j>=1;)
    {
        if(C[j]<S[i]) i--;
        else i--, j--, ans++;
    }
    printf("%d", ans);
}

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &N, &M);
     ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:20:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1; i<=N; i++) scanf("%d%d", &V[i].second, &V[i].first);
                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:21:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1; i<=M; i++) scanf("%d", &C[i]);
                         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...