답안 #706963

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
706963 2023-03-08T07:56:01 Z Dan4Life Exhibition (JOI19_ho_t2) C++17
100 / 100
166 ms 4896 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
const int mxN = (int)1e5+10;
int n, m, a[mxN];
pair<int,int> v[mxN];

bool chk(int mid){
	queue<int> q; while(!q.empty()) q.pop();
	for(int i = 0; i < n; i++) q.push(v[i].se);
	for(int i = m-mid; i < m; i++){
		while(!q.empty() and q.front()>a[i]) q.pop();
		if(!q.empty()) q.pop();
		else return false;
	}
	return true;
}

int main() {
	cin >> n >> m;
	for(int i = 0; i < n; i++) cin >> v[i].se >> v[i].fi;
	for(int i = 0; i < m; i++) cin >> a[i];
	sort(v,v+n), sort(a,a+m);
	int l = 0, r = m;
	while(l<r){
		int mid = (l+r+1)/2;
		if(chk(mid)) l=mid;
		else r=mid-1;
	}
	cout << l;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 308 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 1 ms 312 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 0 ms 212 KB Output is correct
14 Correct 1 ms 308 KB Output is correct
15 Correct 1 ms 212 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 304 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 308 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 1 ms 312 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 0 ms 212 KB Output is correct
14 Correct 1 ms 308 KB Output is correct
15 Correct 1 ms 212 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 304 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 2 ms 324 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 2 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 344 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 3 ms 340 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 3 ms 340 KB Output is correct
31 Correct 3 ms 316 KB Output is correct
32 Correct 2 ms 320 KB Output is correct
33 Correct 1 ms 312 KB Output is correct
34 Correct 2 ms 332 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 308 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 1 ms 312 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 0 ms 212 KB Output is correct
14 Correct 1 ms 308 KB Output is correct
15 Correct 1 ms 212 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 304 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 2 ms 324 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 2 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 344 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 3 ms 340 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 3 ms 340 KB Output is correct
31 Correct 3 ms 316 KB Output is correct
32 Correct 2 ms 320 KB Output is correct
33 Correct 1 ms 312 KB Output is correct
34 Correct 2 ms 332 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 320 KB Output is correct
38 Correct 131 ms 4756 KB Output is correct
39 Correct 137 ms 4800 KB Output is correct
40 Correct 132 ms 4780 KB Output is correct
41 Correct 132 ms 4760 KB Output is correct
42 Correct 131 ms 4764 KB Output is correct
43 Correct 142 ms 4764 KB Output is correct
44 Correct 136 ms 4868 KB Output is correct
45 Correct 129 ms 4728 KB Output is correct
46 Correct 134 ms 4720 KB Output is correct
47 Correct 117 ms 4336 KB Output is correct
48 Correct 128 ms 4324 KB Output is correct
49 Correct 119 ms 3808 KB Output is correct
50 Correct 103 ms 3808 KB Output is correct
51 Correct 131 ms 4768 KB Output is correct
52 Correct 128 ms 4776 KB Output is correct
53 Correct 148 ms 4828 KB Output is correct
54 Correct 133 ms 4896 KB Output is correct
55 Correct 134 ms 4804 KB Output is correct
56 Correct 82 ms 3420 KB Output is correct
57 Correct 43 ms 1524 KB Output is correct
58 Correct 84 ms 3392 KB Output is correct
59 Correct 90 ms 3424 KB Output is correct
60 Correct 45 ms 1592 KB Output is correct
61 Correct 74 ms 2708 KB Output is correct
62 Correct 138 ms 4860 KB Output is correct
63 Correct 140 ms 4808 KB Output is correct
64 Correct 146 ms 4768 KB Output is correct
65 Correct 136 ms 4764 KB Output is correct
66 Correct 133 ms 4756 KB Output is correct
67 Correct 151 ms 4752 KB Output is correct
68 Correct 166 ms 4768 KB Output is correct
69 Correct 139 ms 4752 KB Output is correct
70 Correct 132 ms 4760 KB Output is correct
71 Correct 150 ms 4816 KB Output is correct
72 Correct 136 ms 4788 KB Output is correct
73 Correct 140 ms 4756 KB Output is correct