Submission #854287

# Submission time Handle Problem Language Result Execution time Memory
854287 2023-09-26T16:01:24 Z ZeroCool Exhibition (JOI19_ho_t2) C++14
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

using ll = long long;
using ld = long double;
 
void solve(int T);
void pre();
 
const int N = 1e5 + 5;
const int M = 405;
const int SQRT = 500;
const int LOG = 20;
const int INF = 1e18;
const int MOD = 1e9+7;
const ld EPS = 1e-9;

void pre(){
	#ifdef ONLINE_JUDGE
    ios::sync_with_stdio(false);
    cin.tie(0);
	#endif
	
}

int32_t main(){
	pre();
	int tt = 1;
	//cin>>tt;
	for(int i = 1;i<=tt;i++){
		cerr<<"Case "<<i<<": "<<endl;
		solve(i);
	}
    return 0;
}

struct P{
	int v;
	int s;
};

bool operator<(P a, P b){
	if(a.v == b.v)return a.s < b.s;
	return a.v < b.v;
}

void solve(int T){
    int n,m;
	cin>>n>>m;

	P A[n];

	for(int i = 0;i<n;i++)cin>>A[i].s>>A[i].v;

	sort(A, A+n);
	reverse(A, A+n);

	int B[m];
	for(int i = 0;i<m;i++)cin>>B[i];

	sort(B, B+m);
	
	int dp[m+1];
	for(int i = 0;i<=m;i++)dp[i] = 0;

	for(int i = 0;i<n;i++){
		int k = lower_bound(B, B+m, A[i].s) - B;

		k++;
		for(int j= m;j>=k;j--){
			dp[j] = max(dp[j], dp[j-1] + 1);
		}
	}

	cout<<dp[m]<<endl;

}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -