답안 #626218

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
626218 2022-08-11T10:01:22 Z l_reho Exhibition (JOI19_ho_t2) C++14
100 / 100
63 ms 5612 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define x first
#define y second

vector<pair<ll, ll>> P;
vector<ll> C;

int dp[100002];

void solve(){
	int N, M;
	cin>>N>>M;
	
	P.assign(N, pair<ll, ll>());
	
	
	C.assign(M, 0);
	
	
	for(int i = 0; i < N; i++)
		cin>>P[i].x>>P[i].y;
		
	for(int j = 0; j < M; j++)
		cin>>C[j];
	
	sort(C.begin(), C.end());
	sort(P.begin(), P.end(), [&](pair<ll, ll> p1, pair<ll, ll> p2){
		return p1.second < p2.second || (p1.second == p2.second && p1.first < p2.first);
	});
	
	int ans = 0;
	int j = M-1;
	
	for(int i = N-1; i >= 0; i--){
		
		if(j >= 0 && P[i].first <= C[j]){
			j--;
			ans++;
		}
		
	}
	
	cout<<ans<<endl;
	
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	solve();
	
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 1 ms 212 KB Output is correct
7 Correct 1 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 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 1 ms 212 KB Output is correct
7 Correct 1 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 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 372 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 340 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 340 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 1 ms 212 KB Output is correct
7 Correct 1 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 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 372 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 340 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 340 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 46 ms 2644 KB Output is correct
39 Correct 51 ms 5480 KB Output is correct
40 Correct 40 ms 5612 KB Output is correct
41 Correct 45 ms 5476 KB Output is correct
42 Correct 47 ms 5480 KB Output is correct
43 Correct 50 ms 5480 KB Output is correct
44 Correct 49 ms 5584 KB Output is correct
45 Correct 63 ms 5552 KB Output is correct
46 Correct 44 ms 5452 KB Output is correct
47 Correct 45 ms 4988 KB Output is correct
48 Correct 48 ms 5004 KB Output is correct
49 Correct 36 ms 4512 KB Output is correct
50 Correct 34 ms 4504 KB Output is correct
51 Correct 45 ms 5596 KB Output is correct
52 Correct 61 ms 5592 KB Output is correct
53 Correct 60 ms 5484 KB Output is correct
54 Correct 50 ms 5480 KB Output is correct
55 Correct 54 ms 5480 KB Output is correct
56 Correct 33 ms 3812 KB Output is correct
57 Correct 23 ms 2072 KB Output is correct
58 Correct 30 ms 3800 KB Output is correct
59 Correct 31 ms 3788 KB Output is correct
60 Correct 21 ms 2004 KB Output is correct
61 Correct 28 ms 3176 KB Output is correct
62 Correct 48 ms 5480 KB Output is correct
63 Correct 48 ms 5580 KB Output is correct
64 Correct 47 ms 5492 KB Output is correct
65 Correct 47 ms 5484 KB Output is correct
66 Correct 47 ms 5484 KB Output is correct
67 Correct 47 ms 5492 KB Output is correct
68 Correct 60 ms 5480 KB Output is correct
69 Correct 52 ms 5480 KB Output is correct
70 Correct 50 ms 5608 KB Output is correct
71 Correct 49 ms 5580 KB Output is correct
72 Correct 50 ms 5588 KB Output is correct
73 Correct 47 ms 5480 KB Output is correct