Submission #574984

# Submission time Handle Problem Language Result Execution time Memory
574984 2022-06-09T13:40:17 Z teki Exhibition (JOI19_ho_t2) C++11
50 / 100
120 ms 7324 KB
#include <bits/stdc++.h>

typedef long long ll;

#define pb push_back
#define MS(x,y) memset((x),(y),sizeof((x)))
#define MN 1000000007

using namespace std;

const int MAXN = 1001;
vector<int> frames;
vector<pair<int,int>> pics;
int n,m;
int dp[MAXN][MAXN];

int rec(int posP, int posF) {
    if (posP >= n || posF >= m) return 0;
    if (dp[posP][posF] != -1) return dp[posP][posF];

    int ret = rec(posP+1,posF);

    int org = posF;

    for (; posF<m; posF++) {
        if (frames[posF] >= pics[posP].second) {
            ret = max(ret,rec(posP+1,posF+1)+1);
            break;
        }
    }

    return dp[posP][org] = ret;
}

int main()
{
    #if LOCAL_DEBUG
        fstream cin("in.txt");
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    MS(dp,-1);

    cin>>n>>m;

    pics.resize(n);
    for (int i = 0; i<n; i++) cin>>pics[i].second>>pics[i].first;
    sort(pics.begin(),pics.end());

    frames.resize(m);
    for (int i = 0; i<m; i++) cin>>frames[i];
    sort(frames.begin(),frames.end());

    cout<<rec(0,0)<<endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4308 KB Output is correct
2 Correct 3 ms 4244 KB Output is correct
3 Correct 2 ms 4248 KB Output is correct
4 Correct 2 ms 4180 KB Output is correct
5 Correct 2 ms 4180 KB Output is correct
6 Correct 2 ms 4240 KB Output is correct
7 Correct 3 ms 4180 KB Output is correct
8 Correct 3 ms 4248 KB Output is correct
9 Correct 2 ms 4180 KB Output is correct
10 Correct 3 ms 4180 KB Output is correct
11 Correct 3 ms 4180 KB Output is correct
12 Correct 2 ms 4180 KB Output is correct
13 Correct 2 ms 4180 KB Output is correct
14 Correct 2 ms 4248 KB Output is correct
15 Correct 2 ms 4180 KB Output is correct
16 Correct 3 ms 4244 KB Output is correct
17 Correct 2 ms 4184 KB Output is correct
18 Correct 2 ms 4248 KB Output is correct
19 Correct 2 ms 4180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4308 KB Output is correct
2 Correct 3 ms 4244 KB Output is correct
3 Correct 2 ms 4248 KB Output is correct
4 Correct 2 ms 4180 KB Output is correct
5 Correct 2 ms 4180 KB Output is correct
6 Correct 2 ms 4240 KB Output is correct
7 Correct 3 ms 4180 KB Output is correct
8 Correct 3 ms 4248 KB Output is correct
9 Correct 2 ms 4180 KB Output is correct
10 Correct 3 ms 4180 KB Output is correct
11 Correct 3 ms 4180 KB Output is correct
12 Correct 2 ms 4180 KB Output is correct
13 Correct 2 ms 4180 KB Output is correct
14 Correct 2 ms 4248 KB Output is correct
15 Correct 2 ms 4180 KB Output is correct
16 Correct 3 ms 4244 KB Output is correct
17 Correct 2 ms 4184 KB Output is correct
18 Correct 2 ms 4248 KB Output is correct
19 Correct 2 ms 4180 KB Output is correct
20 Correct 81 ms 4324 KB Output is correct
21 Correct 84 ms 4244 KB Output is correct
22 Correct 3 ms 4352 KB Output is correct
23 Correct 3 ms 4256 KB Output is correct
24 Correct 28 ms 4332 KB Output is correct
25 Correct 40 ms 4308 KB Output is correct
26 Correct 35 ms 4324 KB Output is correct
27 Correct 3 ms 4252 KB Output is correct
28 Correct 3 ms 4308 KB Output is correct
29 Correct 9 ms 4256 KB Output is correct
30 Correct 68 ms 4308 KB Output is correct
31 Correct 69 ms 4324 KB Output is correct
32 Correct 3 ms 4260 KB Output is correct
33 Correct 3 ms 4188 KB Output is correct
34 Correct 16 ms 4308 KB Output is correct
35 Correct 3 ms 4180 KB Output is correct
36 Correct 84 ms 4328 KB Output is correct
37 Correct 74 ms 4328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4308 KB Output is correct
2 Correct 3 ms 4244 KB Output is correct
3 Correct 2 ms 4248 KB Output is correct
4 Correct 2 ms 4180 KB Output is correct
5 Correct 2 ms 4180 KB Output is correct
6 Correct 2 ms 4240 KB Output is correct
7 Correct 3 ms 4180 KB Output is correct
8 Correct 3 ms 4248 KB Output is correct
9 Correct 2 ms 4180 KB Output is correct
10 Correct 3 ms 4180 KB Output is correct
11 Correct 3 ms 4180 KB Output is correct
12 Correct 2 ms 4180 KB Output is correct
13 Correct 2 ms 4180 KB Output is correct
14 Correct 2 ms 4248 KB Output is correct
15 Correct 2 ms 4180 KB Output is correct
16 Correct 3 ms 4244 KB Output is correct
17 Correct 2 ms 4184 KB Output is correct
18 Correct 2 ms 4248 KB Output is correct
19 Correct 2 ms 4180 KB Output is correct
20 Correct 81 ms 4324 KB Output is correct
21 Correct 84 ms 4244 KB Output is correct
22 Correct 3 ms 4352 KB Output is correct
23 Correct 3 ms 4256 KB Output is correct
24 Correct 28 ms 4332 KB Output is correct
25 Correct 40 ms 4308 KB Output is correct
26 Correct 35 ms 4324 KB Output is correct
27 Correct 3 ms 4252 KB Output is correct
28 Correct 3 ms 4308 KB Output is correct
29 Correct 9 ms 4256 KB Output is correct
30 Correct 68 ms 4308 KB Output is correct
31 Correct 69 ms 4324 KB Output is correct
32 Correct 3 ms 4260 KB Output is correct
33 Correct 3 ms 4188 KB Output is correct
34 Correct 16 ms 4308 KB Output is correct
35 Correct 3 ms 4180 KB Output is correct
36 Correct 84 ms 4328 KB Output is correct
37 Correct 74 ms 4328 KB Output is correct
38 Incorrect 120 ms 7324 KB Output isn't correct
39 Halted 0 ms 0 KB -