# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
110371 |
2019-05-10T18:27:17 Z |
pamaj |
Exhibition (JOI19_ho_t2) |
C++14 |
|
91 ms |
10208 KB |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3;
int N, M;
int m[maxn];
int dp[maxn][maxn];
struct pic
{
int val, sz;
bool operator<(const pic& a) const
{
if(val == a.val) return sz < a.sz;
return val < a.val;
}
}v[maxn];
int solve(int i, int j)
{
if(i == N or j == M) return 0;
if(dp[i][j] != -1) return dp[i][j];
int caso1 = solve(i + 1, j);
int caso2 = solve(i, j + 1);
int caso3 = 0;
if(v[i].sz <= m[j]) caso3 = solve(i + 1, j + 1) + 1;
return dp[i][j] = max({caso1, caso2, caso3});
}
int main()
{
memset(dp, -1, sizeof(dp));
cin >> N >> M;
for(int i = 0; i < N; i++)
{
cin >> v[i].sz >> v[i].val;
}
for(int i = 0; i < M; i++)
cin >> m[i];
sort(v, v + N);
sort(m, m + M);
cout << solve(0, 0) << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
4224 KB |
Output is correct |
2 |
Correct |
5 ms |
4224 KB |
Output is correct |
3 |
Correct |
6 ms |
4224 KB |
Output is correct |
4 |
Correct |
5 ms |
4224 KB |
Output is correct |
5 |
Correct |
9 ms |
4224 KB |
Output is correct |
6 |
Correct |
5 ms |
4224 KB |
Output is correct |
7 |
Correct |
6 ms |
4224 KB |
Output is correct |
8 |
Correct |
6 ms |
4196 KB |
Output is correct |
9 |
Correct |
7 ms |
4224 KB |
Output is correct |
10 |
Correct |
6 ms |
4224 KB |
Output is correct |
11 |
Correct |
6 ms |
4224 KB |
Output is correct |
12 |
Correct |
6 ms |
4224 KB |
Output is correct |
13 |
Correct |
6 ms |
4240 KB |
Output is correct |
14 |
Correct |
5 ms |
4224 KB |
Output is correct |
15 |
Correct |
8 ms |
4268 KB |
Output is correct |
16 |
Correct |
7 ms |
4224 KB |
Output is correct |
17 |
Correct |
6 ms |
4224 KB |
Output is correct |
18 |
Correct |
7 ms |
4224 KB |
Output is correct |
19 |
Correct |
5 ms |
4224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
4224 KB |
Output is correct |
2 |
Correct |
5 ms |
4224 KB |
Output is correct |
3 |
Correct |
6 ms |
4224 KB |
Output is correct |
4 |
Correct |
5 ms |
4224 KB |
Output is correct |
5 |
Correct |
9 ms |
4224 KB |
Output is correct |
6 |
Correct |
5 ms |
4224 KB |
Output is correct |
7 |
Correct |
6 ms |
4224 KB |
Output is correct |
8 |
Correct |
6 ms |
4196 KB |
Output is correct |
9 |
Correct |
7 ms |
4224 KB |
Output is correct |
10 |
Correct |
6 ms |
4224 KB |
Output is correct |
11 |
Correct |
6 ms |
4224 KB |
Output is correct |
12 |
Correct |
6 ms |
4224 KB |
Output is correct |
13 |
Correct |
6 ms |
4240 KB |
Output is correct |
14 |
Correct |
5 ms |
4224 KB |
Output is correct |
15 |
Correct |
8 ms |
4268 KB |
Output is correct |
16 |
Correct |
7 ms |
4224 KB |
Output is correct |
17 |
Correct |
6 ms |
4224 KB |
Output is correct |
18 |
Correct |
7 ms |
4224 KB |
Output is correct |
19 |
Correct |
5 ms |
4224 KB |
Output is correct |
20 |
Correct |
19 ms |
4352 KB |
Output is correct |
21 |
Correct |
22 ms |
4352 KB |
Output is correct |
22 |
Correct |
17 ms |
4352 KB |
Output is correct |
23 |
Correct |
17 ms |
4352 KB |
Output is correct |
24 |
Correct |
28 ms |
4324 KB |
Output is correct |
25 |
Correct |
21 ms |
4352 KB |
Output is correct |
26 |
Correct |
18 ms |
4412 KB |
Output is correct |
27 |
Correct |
18 ms |
4352 KB |
Output is correct |
28 |
Correct |
20 ms |
4352 KB |
Output is correct |
29 |
Correct |
21 ms |
4352 KB |
Output is correct |
30 |
Correct |
20 ms |
4352 KB |
Output is correct |
31 |
Correct |
24 ms |
4352 KB |
Output is correct |
32 |
Correct |
6 ms |
4224 KB |
Output is correct |
33 |
Correct |
5 ms |
4224 KB |
Output is correct |
34 |
Correct |
9 ms |
4352 KB |
Output is correct |
35 |
Correct |
6 ms |
4224 KB |
Output is correct |
36 |
Correct |
18 ms |
4352 KB |
Output is correct |
37 |
Correct |
17 ms |
4380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
4224 KB |
Output is correct |
2 |
Correct |
5 ms |
4224 KB |
Output is correct |
3 |
Correct |
6 ms |
4224 KB |
Output is correct |
4 |
Correct |
5 ms |
4224 KB |
Output is correct |
5 |
Correct |
9 ms |
4224 KB |
Output is correct |
6 |
Correct |
5 ms |
4224 KB |
Output is correct |
7 |
Correct |
6 ms |
4224 KB |
Output is correct |
8 |
Correct |
6 ms |
4196 KB |
Output is correct |
9 |
Correct |
7 ms |
4224 KB |
Output is correct |
10 |
Correct |
6 ms |
4224 KB |
Output is correct |
11 |
Correct |
6 ms |
4224 KB |
Output is correct |
12 |
Correct |
6 ms |
4224 KB |
Output is correct |
13 |
Correct |
6 ms |
4240 KB |
Output is correct |
14 |
Correct |
5 ms |
4224 KB |
Output is correct |
15 |
Correct |
8 ms |
4268 KB |
Output is correct |
16 |
Correct |
7 ms |
4224 KB |
Output is correct |
17 |
Correct |
6 ms |
4224 KB |
Output is correct |
18 |
Correct |
7 ms |
4224 KB |
Output is correct |
19 |
Correct |
5 ms |
4224 KB |
Output is correct |
20 |
Correct |
19 ms |
4352 KB |
Output is correct |
21 |
Correct |
22 ms |
4352 KB |
Output is correct |
22 |
Correct |
17 ms |
4352 KB |
Output is correct |
23 |
Correct |
17 ms |
4352 KB |
Output is correct |
24 |
Correct |
28 ms |
4324 KB |
Output is correct |
25 |
Correct |
21 ms |
4352 KB |
Output is correct |
26 |
Correct |
18 ms |
4412 KB |
Output is correct |
27 |
Correct |
18 ms |
4352 KB |
Output is correct |
28 |
Correct |
20 ms |
4352 KB |
Output is correct |
29 |
Correct |
21 ms |
4352 KB |
Output is correct |
30 |
Correct |
20 ms |
4352 KB |
Output is correct |
31 |
Correct |
24 ms |
4352 KB |
Output is correct |
32 |
Correct |
6 ms |
4224 KB |
Output is correct |
33 |
Correct |
5 ms |
4224 KB |
Output is correct |
34 |
Correct |
9 ms |
4352 KB |
Output is correct |
35 |
Correct |
6 ms |
4224 KB |
Output is correct |
36 |
Correct |
18 ms |
4352 KB |
Output is correct |
37 |
Correct |
17 ms |
4380 KB |
Output is correct |
38 |
Runtime error |
91 ms |
10208 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
39 |
Halted |
0 ms |
0 KB |
- |