Submission #209201

# Submission time Handle Problem Language Result Execution time Memory
209201 2020-03-13T11:35:58 Z kostia244 Exhibition (JOI19_ho_t2) C++17
50 / 100
494 ms 13820 KB
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<ll, ll>;
const int maxn= 1030;
int n, m, dp[maxn][maxn];
vector<pi> a;
vi b;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m;
	a.resize(n);
	b.resize(m);
	for(int i = 0; i < n; i++) cin >> a[i].second >> a[i].first;
	for(int i = 0; i < m; i++) cin >> b[i];
	sort(all(a));
	sort(all(b));
	memset(dp, -0x3f, sizeof dp);
	dp[0][0] = 0;
	for(int i = 0; i <= n; i++) {
		for(int j = 0; j <= m; j++) {
			dp[i+1][j] = max(dp[i][j], dp[i+1][j]);
			dp[i][j+1] = max(dp[i][j], dp[i][j+1]);
			if(i<n&&j<m&&a[i].second<=b[j])
				dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1);
		}
	}
	cout << dp[n][m];
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4472 KB Output is correct
2 Correct 7 ms 4472 KB Output is correct
3 Correct 7 ms 4472 KB Output is correct
4 Correct 7 ms 4472 KB Output is correct
5 Correct 8 ms 4472 KB Output is correct
6 Correct 7 ms 4472 KB Output is correct
7 Correct 7 ms 4472 KB Output is correct
8 Correct 7 ms 4472 KB Output is correct
9 Correct 8 ms 4472 KB Output is correct
10 Correct 7 ms 4472 KB Output is correct
11 Correct 7 ms 4472 KB Output is correct
12 Correct 7 ms 4472 KB Output is correct
13 Correct 7 ms 4472 KB Output is correct
14 Correct 7 ms 4476 KB Output is correct
15 Correct 7 ms 4472 KB Output is correct
16 Correct 7 ms 4472 KB Output is correct
17 Correct 7 ms 4476 KB Output is correct
18 Correct 7 ms 4472 KB Output is correct
19 Correct 7 ms 4472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4472 KB Output is correct
2 Correct 7 ms 4472 KB Output is correct
3 Correct 7 ms 4472 KB Output is correct
4 Correct 7 ms 4472 KB Output is correct
5 Correct 8 ms 4472 KB Output is correct
6 Correct 7 ms 4472 KB Output is correct
7 Correct 7 ms 4472 KB Output is correct
8 Correct 7 ms 4472 KB Output is correct
9 Correct 8 ms 4472 KB Output is correct
10 Correct 7 ms 4472 KB Output is correct
11 Correct 7 ms 4472 KB Output is correct
12 Correct 7 ms 4472 KB Output is correct
13 Correct 7 ms 4472 KB Output is correct
14 Correct 7 ms 4476 KB Output is correct
15 Correct 7 ms 4472 KB Output is correct
16 Correct 7 ms 4472 KB Output is correct
17 Correct 7 ms 4476 KB Output is correct
18 Correct 7 ms 4472 KB Output is correct
19 Correct 7 ms 4472 KB Output is correct
20 Correct 12 ms 4600 KB Output is correct
21 Correct 12 ms 4600 KB Output is correct
22 Correct 12 ms 4600 KB Output is correct
23 Correct 12 ms 4472 KB Output is correct
24 Correct 12 ms 4600 KB Output is correct
25 Correct 12 ms 4472 KB Output is correct
26 Correct 12 ms 4600 KB Output is correct
27 Correct 12 ms 4600 KB Output is correct
28 Correct 12 ms 4600 KB Output is correct
29 Correct 12 ms 4472 KB Output is correct
30 Correct 12 ms 4472 KB Output is correct
31 Correct 13 ms 4472 KB Output is correct
32 Correct 8 ms 4472 KB Output is correct
33 Correct 7 ms 4472 KB Output is correct
34 Correct 9 ms 4524 KB Output is correct
35 Correct 7 ms 4472 KB Output is correct
36 Correct 12 ms 4476 KB Output is correct
37 Correct 12 ms 4472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4472 KB Output is correct
2 Correct 7 ms 4472 KB Output is correct
3 Correct 7 ms 4472 KB Output is correct
4 Correct 7 ms 4472 KB Output is correct
5 Correct 8 ms 4472 KB Output is correct
6 Correct 7 ms 4472 KB Output is correct
7 Correct 7 ms 4472 KB Output is correct
8 Correct 7 ms 4472 KB Output is correct
9 Correct 8 ms 4472 KB Output is correct
10 Correct 7 ms 4472 KB Output is correct
11 Correct 7 ms 4472 KB Output is correct
12 Correct 7 ms 4472 KB Output is correct
13 Correct 7 ms 4472 KB Output is correct
14 Correct 7 ms 4476 KB Output is correct
15 Correct 7 ms 4472 KB Output is correct
16 Correct 7 ms 4472 KB Output is correct
17 Correct 7 ms 4476 KB Output is correct
18 Correct 7 ms 4472 KB Output is correct
19 Correct 7 ms 4472 KB Output is correct
20 Correct 12 ms 4600 KB Output is correct
21 Correct 12 ms 4600 KB Output is correct
22 Correct 12 ms 4600 KB Output is correct
23 Correct 12 ms 4472 KB Output is correct
24 Correct 12 ms 4600 KB Output is correct
25 Correct 12 ms 4472 KB Output is correct
26 Correct 12 ms 4600 KB Output is correct
27 Correct 12 ms 4600 KB Output is correct
28 Correct 12 ms 4600 KB Output is correct
29 Correct 12 ms 4472 KB Output is correct
30 Correct 12 ms 4472 KB Output is correct
31 Correct 13 ms 4472 KB Output is correct
32 Correct 8 ms 4472 KB Output is correct
33 Correct 7 ms 4472 KB Output is correct
34 Correct 9 ms 4524 KB Output is correct
35 Correct 7 ms 4472 KB Output is correct
36 Correct 12 ms 4476 KB Output is correct
37 Correct 12 ms 4472 KB Output is correct
38 Runtime error 494 ms 13820 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Halted 0 ms 0 KB -