Submission #110472

#TimeUsernameProblemLanguageResultExecution timeMemory
110472samsExhibition (JOI19_ho_t2)C++14
100 / 100
106 ms1656 KiB
#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()
{
	scanf("%d%d", &n, &m);

	for(int i = 1 ; i <= n ; ++i) scanf("%d%d", &in[i].s, &in[i].v);
	for(int i = 1 ; i <= m ; ++i) scanf("%d", &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 && in[pos].s > mol[i]; pos--);

		if(pos >= 1)
		{
			ans++;
			pos--;
		}
	}
	printf("%d\n", ans);
  	return 0;
}

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:23:37: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 1 ; i <= n ; ++i) scanf("%d%d", &in[i].s, &in[i].v);
                                ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:24:37: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 1 ; i <= m ; ++i) scanf("%d", &mol[i]);
                                ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...