Submission #110468

# Submission time Handle Problem Language Result Execution time Memory
110468 2019-05-10T21:27:47 Z sams Exhibition (JOI19_ho_t2) C++14
0 / 100
1000 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5+10;

struct pic{
	int s, v;
} in[maxn];

bool comp(pic a, pic b)
{
	if(a.v != b.v) return a.v < b.v;
	return a.s < b.s;
}
int n, m;
int mol[maxn];

int main()
{
	cin >> n >> m;

	for(int i = 1 ; i <= n ; ++i) cin >> in[i].s >> in[i].v;
	for(int i = 1 ; i <= m ; ++i) cin >> mol[i];
	
	sort(in + 1, in+n+1, comp);
	sort(mol+1, mol+m+1);
	
	int ans = 0, pos = n;

	for(int i = m ; i >= 1; ++i)
	{
		for(; pos >= 1 && mol[i] < in[pos].s; pos--)
		if(pos >= 1)
		{
			ans++;
			pos--;
		}
	}
	cout << ans << "\n";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -