Submission #953434

# Submission time Handle Problem Language Result Execution time Memory
953434 2024-03-26T01:12:16 Z irmuun Exhibition (JOI19_ho_t2) C++17
50 / 100
199 ms 274432 KB
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n,m;
    cin>>n>>m;
    pair<ll,ll>pr[n+5];
    for(ll i=1;i<=n;i++){
        cin>>pr[i].ss>>pr[i].ff;
    }
    ll c[m+5];
    for(ll i=1;i<=m;i++){
        cin>>c[i];
    }
    sort(pr+1,pr+n+1);
    sort(c+1,c+m+1);
    ll dp[n+5][m+5];
    memset(dp,0,sizeof dp);
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=m;j++){
            if(pr[i].ss>c[j]){
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
            else{
                dp[i][j]=max({dp[i-1][j],dp[i][j-1],dp[i-1][j-1]+1});
            }
        }
    }
    cout<<dp[n][m];
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 404 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 460 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 404 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 460 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 6 ms 8284 KB Output is correct
21 Correct 6 ms 8284 KB Output is correct
22 Correct 7 ms 8280 KB Output is correct
23 Correct 6 ms 8180 KB Output is correct
24 Correct 6 ms 8404 KB Output is correct
25 Correct 8 ms 8144 KB Output is correct
26 Correct 7 ms 8284 KB Output is correct
27 Correct 6 ms 8188 KB Output is correct
28 Correct 6 ms 8280 KB Output is correct
29 Correct 7 ms 8284 KB Output is correct
30 Correct 6 ms 8176 KB Output is correct
31 Correct 7 ms 8404 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 2 ms 2652 KB Output is correct
35 Correct 1 ms 604 KB Output is correct
36 Correct 6 ms 8284 KB Output is correct
37 Correct 6 ms 8284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 404 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 460 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 6 ms 8284 KB Output is correct
21 Correct 6 ms 8284 KB Output is correct
22 Correct 7 ms 8280 KB Output is correct
23 Correct 6 ms 8180 KB Output is correct
24 Correct 6 ms 8404 KB Output is correct
25 Correct 8 ms 8144 KB Output is correct
26 Correct 7 ms 8284 KB Output is correct
27 Correct 6 ms 8188 KB Output is correct
28 Correct 6 ms 8280 KB Output is correct
29 Correct 7 ms 8284 KB Output is correct
30 Correct 6 ms 8176 KB Output is correct
31 Correct 7 ms 8404 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 2 ms 2652 KB Output is correct
35 Correct 1 ms 604 KB Output is correct
36 Correct 6 ms 8284 KB Output is correct
37 Correct 6 ms 8284 KB Output is correct
38 Runtime error 199 ms 274432 KB Execution killed with signal 9
39 Halted 0 ms 0 KB -