제출 #1169658

#제출 시각아이디문제언어결과실행 시간메모리
1169658lufychopExhibition (JOI19_ho_t2)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h>

using namespace std;

int main(void)
{
	int n,m,s,v,c,cnt=0;
	cin>>n>>m;
	vector<int> frame;
	vector<pair<int,int>> x;
	for(int i=0;i<n;i++)
	{
		cin>>s>>v;
		x.push_back({v,s});
	}
	for(int i=0;i<m;i++)
	{
		cin>>c;
		frame.push_back(c);
	}
	n--;
	m--;
	sort(x.begin(),x.end());
	sort(frame.begin(),frame.end());
	while(n>=0 && m>=0)
	{
		if(x[n].second<=frame[m])
		{
			cnt++;
			n--;
			m--;
		}
		else
		{
			m--;
		}
	}
	cout<<cnt;
	return 0;
}
/*
3 4
10 20
5 1
3 5
4
6
10
4

4 4 6 10
5 3 10

4 5 7 7 7 4 3 3 3 4 4

3 2
1 2
1 2
1 2
1
1

8 8
9 3
8 8
7 2
15 5
14 4
12 7
10 1
3 6
4
16
1
13
5
6
11
2

 1 2 4 5 6 11 13 16
10 7 9 14 15 3 12 8

11 13 16
 7  9 14
10  9 14



8 8
508917604 35617051
501958939 840246141
485338402 32896484
957730250 357542366
904165504 137209882
684085683 775621730
552953629 20004459
125090903 607302990
433255278
979756183
28423637
856448848
276518245
314201319
666094038
149542543
*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...