답안 #697998

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
697998 2023-02-11T18:08:48 Z cpLover22 Exhibition (JOI19_ho_t2) C++17
50 / 100
28 ms 8256 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
typedef pair<int, int> pii;
#define fi first
#define se second 

const int N = 1e5 + 5;

int n, m;
pii a[N]; int c[N];

namespace sub2 {
	const int N = 1e3 + 5;
	ll dp[N][N];
	
	void sol() {
		sort(a + 1, a + n + 1, [&](auto &x, auto &y) {
			if (x.se == y.se) return x.fi < y.fi;
			return x.se < y.se;
		});
		sort(c + 1, c + m + 1);
		
		for (int i = 1; i <= n; ++i)
			for (int j = 1; j <= m; ++j) {
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
				if (a[i].fi <= c[j]) 
					dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1);
			}
		cout << dp[n][m];
	}
}

namespace sub3 {
	void sol() {
		
	}
}

signed main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n >> m;
	for (int i = 1; i <= n; ++i)
		cin >> a[i].fi >> a[i].se;
	for (int i = 1; i <= m; ++i)
		cin >> c[i];
		
	if (n <= 1e3 && m <= 1e3) sub2::sol();
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 332 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 332 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 0 ms 332 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 332 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 332 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 0 ms 332 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 7 ms 8148 KB Output is correct
21 Correct 8 ms 8244 KB Output is correct
22 Correct 7 ms 8148 KB Output is correct
23 Correct 7 ms 8192 KB Output is correct
24 Correct 8 ms 8152 KB Output is correct
25 Correct 8 ms 8148 KB Output is correct
26 Correct 8 ms 8148 KB Output is correct
27 Correct 7 ms 8148 KB Output is correct
28 Correct 8 ms 8256 KB Output is correct
29 Correct 8 ms 8152 KB Output is correct
30 Correct 8 ms 8144 KB Output is correct
31 Correct 8 ms 8144 KB Output is correct
32 Correct 3 ms 4308 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 5 ms 6612 KB Output is correct
35 Correct 1 ms 472 KB Output is correct
36 Correct 7 ms 8148 KB Output is correct
37 Correct 7 ms 8148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 332 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 332 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 0 ms 332 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 7 ms 8148 KB Output is correct
21 Correct 8 ms 8244 KB Output is correct
22 Correct 7 ms 8148 KB Output is correct
23 Correct 7 ms 8192 KB Output is correct
24 Correct 8 ms 8152 KB Output is correct
25 Correct 8 ms 8148 KB Output is correct
26 Correct 8 ms 8148 KB Output is correct
27 Correct 7 ms 8148 KB Output is correct
28 Correct 8 ms 8256 KB Output is correct
29 Correct 8 ms 8152 KB Output is correct
30 Correct 8 ms 8144 KB Output is correct
31 Correct 8 ms 8144 KB Output is correct
32 Correct 3 ms 4308 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 5 ms 6612 KB Output is correct
35 Correct 1 ms 472 KB Output is correct
36 Correct 7 ms 8148 KB Output is correct
37 Correct 7 ms 8148 KB Output is correct
38 Incorrect 28 ms 4272 KB Output isn't correct
39 Halted 0 ms 0 KB -