Submission #139688

# Submission time Handle Problem Language Result Execution time Memory
139688 2019-08-01T09:01:30 Z duckmoon99 Exhibition (JOI19_ho_t2) C++14
50 / 100
246 ms 10232 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;

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]) dp[i%2][j]=max(dp[i%2][j],dp[(i+1)%2][j-1]+1);
			ans=max(ans,dp[i%2][j]);
		}
	}
	cout<<ans<<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 380 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 504 KB Output is correct
17 Correct 2 ms 364 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 380 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 504 KB Output is correct
17 Correct 2 ms 364 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 6 ms 376 KB Output is correct
21 Correct 6 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 6 ms 376 KB Output is correct
26 Correct 6 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 6 ms 376 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 5 ms 376 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 3 ms 376 KB Output is correct
33 Correct 3 ms 376 KB Output is correct
34 Correct 4 ms 376 KB Output is correct
35 Correct 3 ms 376 KB Output is correct
36 Correct 6 ms 376 KB Output is correct
37 Correct 6 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 380 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 504 KB Output is correct
17 Correct 2 ms 364 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 6 ms 376 KB Output is correct
21 Correct 6 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 6 ms 376 KB Output is correct
26 Correct 6 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 6 ms 376 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 5 ms 376 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 3 ms 376 KB Output is correct
33 Correct 3 ms 376 KB Output is correct
34 Correct 4 ms 376 KB Output is correct
35 Correct 3 ms 376 KB Output is correct
36 Correct 6 ms 376 KB Output is correct
37 Correct 6 ms 376 KB Output is correct
38 Runtime error 246 ms 10232 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Halted 0 ms 0 KB -