Submission #538432

# Submission time Handle Problem Language Result Execution time Memory
538432 2022-03-16T21:28:00 Z new_acc Exhibition (JOI19_ho_t2) C++14
100 / 100
170 ms 1544 KB
#include<bits/stdc++.h>
#define fi first
#define se second
#define pitem item*
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int N=1e6+10;
pair<int,int> t[N];
int t2[N];
int n,m;
int bs(int x){
	int pocz=1,kon=m,sr,res=-1;
	while(pocz<=kon){
		sr=(pocz+kon)>>1;
		if(t2[sr]>=x) res=sr,kon=sr-1;
		else pocz=sr+1;
	}
	return res;
}
void solve(){
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>t[i].se>>t[i].fi;
	sort(t+1,t+1+n);
	for(int i=1;i<=m;i++) cin>>t2[i];
	sort(t2+1,t2+1+m);
	int maxi=0;
	for(int i=n;i>=1;i--){
		int g=bs(t[i].se);
		if(g==-1) continue;
		g=m-g+1;
		g=min(g,maxi+1);
		maxi=max(maxi,g);
	}
	cout<<maxi<<"\n";
}
int main(){
	solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 300 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 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 300 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 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 2 ms 212 KB Output is correct
21 Correct 2 ms 212 KB Output is correct
22 Correct 2 ms 212 KB Output is correct
23 Correct 2 ms 212 KB Output is correct
24 Correct 2 ms 212 KB Output is correct
25 Correct 2 ms 212 KB Output is correct
26 Correct 2 ms 212 KB Output is correct
27 Correct 2 ms 212 KB Output is correct
28 Correct 2 ms 212 KB Output is correct
29 Correct 2 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 2 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 2 ms 212 KB Output is correct
37 Correct 2 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 300 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 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 2 ms 212 KB Output is correct
21 Correct 2 ms 212 KB Output is correct
22 Correct 2 ms 212 KB Output is correct
23 Correct 2 ms 212 KB Output is correct
24 Correct 2 ms 212 KB Output is correct
25 Correct 2 ms 212 KB Output is correct
26 Correct 2 ms 212 KB Output is correct
27 Correct 2 ms 212 KB Output is correct
28 Correct 2 ms 212 KB Output is correct
29 Correct 2 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 2 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 2 ms 212 KB Output is correct
37 Correct 2 ms 212 KB Output is correct
38 Correct 127 ms 1392 KB Output is correct
39 Correct 119 ms 1432 KB Output is correct
40 Correct 170 ms 1476 KB Output is correct
41 Correct 123 ms 1460 KB Output is correct
42 Correct 122 ms 1412 KB Output is correct
43 Correct 125 ms 1544 KB Output is correct
44 Correct 123 ms 1444 KB Output is correct
45 Correct 128 ms 1464 KB Output is correct
46 Correct 121 ms 1356 KB Output is correct
47 Correct 120 ms 1360 KB Output is correct
48 Correct 109 ms 1324 KB Output is correct
49 Correct 103 ms 1200 KB Output is correct
50 Correct 98 ms 1132 KB Output is correct
51 Correct 127 ms 1424 KB Output is correct
52 Correct 124 ms 1356 KB Output is correct
53 Correct 121 ms 1368 KB Output is correct
54 Correct 115 ms 1400 KB Output is correct
55 Correct 128 ms 1436 KB Output is correct
56 Correct 86 ms 1100 KB Output is correct
57 Correct 44 ms 684 KB Output is correct
58 Correct 79 ms 1060 KB Output is correct
59 Correct 83 ms 1084 KB Output is correct
60 Correct 43 ms 680 KB Output is correct
61 Correct 74 ms 956 KB Output is correct
62 Correct 133 ms 1456 KB Output is correct
63 Correct 133 ms 1388 KB Output is correct
64 Correct 132 ms 1412 KB Output is correct
65 Correct 136 ms 1516 KB Output is correct
66 Correct 131 ms 1476 KB Output is correct
67 Correct 134 ms 1476 KB Output is correct
68 Correct 135 ms 1356 KB Output is correct
69 Correct 134 ms 1460 KB Output is correct
70 Correct 133 ms 1456 KB Output is correct
71 Correct 135 ms 1372 KB Output is correct
72 Correct 128 ms 1380 KB Output is correct
73 Correct 126 ms 1456 KB Output is correct