Submission #704312

#TimeUsernameProblemLanguageResultExecution timeMemory
704312alanlExhibition (JOI19_ho_t2)C++14
50 / 100
2 ms344 KiB
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define rep(X, a,b) for(int X=a;X<b;++X)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (int)(a).size()
#define NL "\n"
using namespace std;
typedef pair<long long,long long> pll;
typedef pair<int,int> pii;
typedef long long ll;
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << "," << p.second << ')'; }
template<typename A> ostream& operator<<(ostream &os, const vector<A> &p){
    for(const auto &a:p)
        os << a << " ";
    os << "\n";
    return os;
}

ll dp[1010];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin>>n>>m;
    if(n>1000) return 0;
    vector<pll> val(n);
    vector<ll> fr(m);
    rep(i,0,n) cin>>val[i].s>>val[i].f;
    sort(ALL(val));
    rep(i,0,m) cin>>fr[i];
    sort(ALL(fr));
    rep(i,0,n){
        for(int j=m-1;j>=0;--j){
            if(fr[j]<val[i].s) break;
            dp[j]=(j>0?dp[j-1]:0)+1;
        }
    }
    ll mx=0;
    rep(i,0,m) mx=max(mx, dp[i]);
    cout<<mx<<NL;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...