| 记录编号 | 
        205197 | 
        评测结果 | 
        AAAAAAAAAA | 
    
    
        | 题目名称 | 
        2086.平凡的题面 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         lyxin65 | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.285 s  | 
    
    
        | 提交时间 | 
        2015-11-04 21:37:06 | 
        内存使用 | 
        1.46 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
const int maxn = 100005;
int n, m;
int x[maxn];
std::pair<int, int> s[maxn];
std::priority_queue<int, std::vector<int>, std::greater<int> > q;
int main()
{
	freopen("bg.in", "r", stdin);
	freopen("bg.out", "w", stdout);
	
	std::ios::sync_with_stdio(false);
	
	std::cin >> n >> m;
	for(int i = 0; i < n; ++i)
		std::cin >> x[i];
	for(int i = 0; i < m; ++i)
		std::cin >> s[i].first >> s[i].second;
	
	std::sort(x, x + n);
	std::sort(s, s + m);
	
	int ans = 0;
	int j = 0;
	for(int i = 0; i < n; ++i)
	{
		while(j < m && s[j].first <= x[i])
			q.push(s[j++].second);
		int y = 0;
		do {
			if(q.empty()) break;
			y = q.top();
			q.pop();
		} while(y < x[i]);
		if(y >= x[i]) ans++;
	}
	std::cout << ans << std::endl;
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}