Submission #551991

# Submission time Handle Problem Language Result Execution time Memory
551991 2022-04-22T05:33:23 Z Gurban Exhibition (JOI19_ho_t2) C++17
100 / 100
47 ms 1632 KB
#include "bits/stdc++.h"
using namespace std;

using ll = long long;

const int maxn=2e5+5;
int n,m;
// int T[maxn << 2];

// void upd(int idx,int val,int l,int r,int nd){
// 	if(l == r){
// 		T[nd] = val;
// 		return;
// 	}
// 	int md = (l + r) >> 1;
// 	if(idx <= md) upd(idx,val,l,md,nd<<1);
// 	else upd(idx,val,md+1,r,nd<<1 | 1);
// 	T[nd] = max(T[nd<<1],T[nd<<1 | 1]);
// }

// int tap(int a,int b,int l,int r,int nd){
// 	if(r < a or l > b) return 0;
// 	if(l >= a and r <= b) return T[nd];
// 	int md = (l + r) >> 1;
// 	return max(tap(a,b,l,md,nd<<1),tap(a,b,md+1,r,nd<<1 | 1));
// }

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> n >> m;
	vector<pair<int,int>>a;
	for(int i = 0;i < n;i++){
		int s,v; cin >> s >> v;
		a.push_back({v,s});
	}
	vector<int>c(m);
	for(int i = 0;i < m;i++) cin >> c[i];
	sort(c.begin(),c.end());
	sort(a.begin(),a.end());

	int now = (int)c.size()-1;
	for(int i = (int)a.size()-1;i >= 0;i--){
		if(now < 0) break;
		if(a[i].second <= c[now]) now--;
	}
	cout<<(int)c.size()-now-1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 316 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 316 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 320 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 328 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 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 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 328 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 316 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 320 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 328 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 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 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 328 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 356 KB Output is correct
38 Correct 45 ms 1564 KB Output is correct
39 Correct 39 ms 1512 KB Output is correct
40 Correct 38 ms 1552 KB Output is correct
41 Correct 45 ms 1632 KB Output is correct
42 Correct 43 ms 1440 KB Output is correct
43 Correct 42 ms 1536 KB Output is correct
44 Correct 44 ms 1484 KB Output is correct
45 Correct 43 ms 1532 KB Output is correct
46 Correct 43 ms 1536 KB Output is correct
47 Correct 38 ms 1544 KB Output is correct
48 Correct 44 ms 1492 KB Output is correct
49 Correct 36 ms 1516 KB Output is correct
50 Correct 36 ms 1476 KB Output is correct
51 Correct 44 ms 1492 KB Output is correct
52 Correct 43 ms 1492 KB Output is correct
53 Correct 44 ms 1476 KB Output is correct
54 Correct 38 ms 1472 KB Output is correct
55 Correct 44 ms 1548 KB Output is correct
56 Correct 27 ms 1492 KB Output is correct
57 Correct 19 ms 752 KB Output is correct
58 Correct 28 ms 1536 KB Output is correct
59 Correct 27 ms 1496 KB Output is correct
60 Correct 18 ms 724 KB Output is correct
61 Correct 28 ms 1108 KB Output is correct
62 Correct 44 ms 1552 KB Output is correct
63 Correct 42 ms 1492 KB Output is correct
64 Correct 43 ms 1524 KB Output is correct
65 Correct 46 ms 1612 KB Output is correct
66 Correct 43 ms 1536 KB Output is correct
67 Correct 45 ms 1492 KB Output is correct
68 Correct 42 ms 1492 KB Output is correct
69 Correct 47 ms 1576 KB Output is correct
70 Correct 45 ms 1536 KB Output is correct
71 Correct 46 ms 1492 KB Output is correct
72 Correct 45 ms 1492 KB Output is correct
73 Correct 41 ms 1452 KB Output is correct