Submission #721012

# Submission time Handle Problem Language Result Execution time Memory
721012 2023-04-10T03:58:52 Z pcc Exhibition (JOI19_ho_t2) C++14
100 / 100
594 ms 10248 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define int ll
#define pll pair<ll,ll>
#define fs first
#define sc second
const ll mxn = 1e5+10;
ll n,m;
pll arr[mxn];
ll brr[mxn];

bool f(ll k){
	multiset<ll> st;
	int p = 0;
	int pre = 0;
	for(int i = m-k;i<m;i++){
		while(p<n&&arr[p].fs<=brr[i]){
			st.insert(arr[p].sc);
			p++;
		}
		auto it = st.lower_bound(pre);
		if(it == st.end())return false;
		pre = *it;
		st.erase(st.find(*it));
	}
	return true;
}

main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>m;
	for(int i = 0;i<n;i++)cin>>arr[i].fs>>arr[i].sc;
	for(int i = 0;i<m;i++)cin>>brr[i];
	sort(arr,arr+n);
	sort(brr,brr+m);
	int l = 0,r = m;
	while(l != r){
		int mid = (l+r+1)>>1;
		if(f(mid))l = mid;
		else r = mid-1;
	}
	cout<<l;
}

Compilation message

joi2019_ho_t2.cpp:31:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   31 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 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 0 ms 212 KB Output is correct
16 Correct 1 ms 212 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 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 0 ms 212 KB Output is correct
16 Correct 1 ms 212 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 1 ms 340 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 340 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 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 0 ms 212 KB Output is correct
16 Correct 1 ms 212 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 1 ms 340 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 340 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
38 Correct 210 ms 4944 KB Output is correct
39 Correct 257 ms 7904 KB Output is correct
40 Correct 287 ms 8396 KB Output is correct
41 Correct 240 ms 7856 KB Output is correct
42 Correct 47 ms 5548 KB Output is correct
43 Correct 43 ms 5544 KB Output is correct
44 Correct 320 ms 7900 KB Output is correct
45 Correct 508 ms 9544 KB Output is correct
46 Correct 517 ms 9484 KB Output is correct
47 Correct 594 ms 8628 KB Output is correct
48 Correct 545 ms 8604 KB Output is correct
49 Correct 336 ms 7272 KB Output is correct
50 Correct 378 ms 7256 KB Output is correct
51 Correct 45 ms 5560 KB Output is correct
52 Correct 47 ms 5456 KB Output is correct
53 Correct 47 ms 5452 KB Output is correct
54 Correct 421 ms 10248 KB Output is correct
55 Correct 263 ms 8016 KB Output is correct
56 Correct 42 ms 6176 KB Output is correct
57 Correct 17 ms 2008 KB Output is correct
58 Correct 124 ms 8396 KB Output is correct
59 Correct 442 ms 8524 KB Output is correct
60 Correct 17 ms 1996 KB Output is correct
61 Correct 161 ms 4492 KB Output is correct
62 Correct 481 ms 7904 KB Output is correct
63 Correct 470 ms 7864 KB Output is correct
64 Correct 471 ms 7968 KB Output is correct
65 Correct 491 ms 7908 KB Output is correct
66 Correct 480 ms 7912 KB Output is correct
67 Correct 518 ms 7920 KB Output is correct
68 Correct 460 ms 7900 KB Output is correct
69 Correct 489 ms 7908 KB Output is correct
70 Correct 497 ms 7920 KB Output is correct
71 Correct 461 ms 7916 KB Output is correct
72 Correct 475 ms 7908 KB Output is correct
73 Correct 392 ms 8076 KB Output is correct