답안 #572067

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
572067 2022-06-03T13:30:18 Z 1ne Exhibition (JOI19_ho_t2) C++14
50 / 100
153 ms 274432 KB
#include<bits/stdc++.h>
using namespace std;
const long long mxn = 1e12;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	long long n,m;cin>>n>>m;
	vector<pair<long long ,long long>>arr(n);
	for (int i = 0;i<n;++i){
		cin>>arr[i].second>>arr[i].first;
	}
	vector<long long >brr(m);
	for (int i = 0;i<m;++i)cin>>brr[i];
	sort(brr.begin(),brr.end());
	sort(arr.begin(),arr.end());
	vector<vector<long long>>dp(n + 1,vector<long long>(m + 1,-1));
	function<long long(int,int)> solve = [&](int cur,int pos){
		if (cur==n)return 0LL;
		if (pos==m)return 0LL;
		if (dp[cur][pos]!=-1)return dp[cur][pos];
		long long ans = solve(cur + 1,pos);
		if (pos + 1 < m)
			ans = max(ans,solve(cur,pos + 1));
		if (pos < m && brr[pos]>=arr[cur].second){
			ans = max(ans,solve(cur + 1,pos + 1) + 1);
		}
		return dp[cur][pos] = ans;
	};
	long long ans = solve(0,0);
	cout<<ans<<'\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 324 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 224 KB Output is correct
16 Correct 0 ms 316 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 324 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 224 KB Output is correct
16 Correct 0 ms 316 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 30 ms 8468 KB Output is correct
21 Correct 27 ms 8404 KB Output is correct
22 Correct 25 ms 8404 KB Output is correct
23 Correct 30 ms 8544 KB Output is correct
24 Correct 29 ms 8404 KB Output is correct
25 Correct 28 ms 8276 KB Output is correct
26 Correct 28 ms 8404 KB Output is correct
27 Correct 25 ms 8404 KB Output is correct
28 Correct 28 ms 8396 KB Output is correct
29 Correct 31 ms 8404 KB Output is correct
30 Correct 28 ms 8404 KB Output is correct
31 Correct 27 ms 8472 KB Output is correct
32 Correct 1 ms 456 KB Output is correct
33 Correct 1 ms 468 KB Output is correct
34 Correct 9 ms 2772 KB Output is correct
35 Correct 2 ms 596 KB Output is correct
36 Correct 27 ms 8452 KB Output is correct
37 Correct 29 ms 8404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 324 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 224 KB Output is correct
16 Correct 0 ms 316 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 30 ms 8468 KB Output is correct
21 Correct 27 ms 8404 KB Output is correct
22 Correct 25 ms 8404 KB Output is correct
23 Correct 30 ms 8544 KB Output is correct
24 Correct 29 ms 8404 KB Output is correct
25 Correct 28 ms 8276 KB Output is correct
26 Correct 28 ms 8404 KB Output is correct
27 Correct 25 ms 8404 KB Output is correct
28 Correct 28 ms 8396 KB Output is correct
29 Correct 31 ms 8404 KB Output is correct
30 Correct 28 ms 8404 KB Output is correct
31 Correct 27 ms 8472 KB Output is correct
32 Correct 1 ms 456 KB Output is correct
33 Correct 1 ms 468 KB Output is correct
34 Correct 9 ms 2772 KB Output is correct
35 Correct 2 ms 596 KB Output is correct
36 Correct 27 ms 8452 KB Output is correct
37 Correct 29 ms 8404 KB Output is correct
38 Runtime error 153 ms 274432 KB Execution killed with signal 9
39 Halted 0 ms 0 KB -