Submission #139709

# Submission time Handle Problem Language Result Execution time Memory
139709 2019-08-01T09:38:56 Z duckmoon99 Exhibition (JOI19_ho_t2) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace std::chrono;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector <ii> vii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll dp[2][1001],cc;
vi c;
vii paint;
ii s;
bool taken[1001];

int main(){
	int n,m;cin>>n>>m;
	for(int i = 0; i < n; i++){
		cin >> s.se >> s.fi;
		paint.pb(s);
	}
	sort(paint.begin(),paint.end());
	for(int i = 0; i < m; i++){
		cin >> cc;
		c.pb(cc);
	}
	c.pb(0);
	sort(c.begin(),c.end());
	ll ans=0;
	for(int i = 0; i < n; i++){
		for(int j = 1; j <= m; j++){
			dp[i%2][j]=dp[(i+1)%2][j];
			if(paint[i].se<=c[j] && taken[j]==0){
				taken[j]=1;
				for(int k = j+1; k <= m; k++){
					dp[i%2][k]=dp[(i+1)%2][k]+1;
					ans=max(ans,dp[i%2][k]);
				}
				j=m+1;
			}
		}
	}
	cout<<ans<<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -