Submission #253509

#TimeUsernameProblemLanguageResultExecution timeMemory
253509ChrisTExhibition (JOI19_ho_t2)C++17
100 / 100
101 ms4472 KiB
#include<bits/stdc++.h>
using namespace std;
int main () {
	int n,m;
	scanf ("%d %d",&n,&m);
	vector<pair<int,int>> a(n);
	for (auto &au : a) scanf ("%d %d",&au.first,&au.second);
	vector<int> b(m);
	for (auto &au : b) scanf ("%d",&au);
	sort(a.begin(),a.end(),[](const auto &aa, const auto &bb) {return aa.second > bb.second || (aa.second == bb.second && aa.first > bb.first);});
	sort(b.rbegin(),b.rend());
	int lstv = INT_MAX, ind = 0;
	for (auto p : a) {
		if (ind < m && p.second <= lstv && p.first <= b[ind]) {
			++ind;
			lstv = p.second;
		}
	}
	printf ("%d\n",ind);
	return 0;
}

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:5:8: 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:7:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (auto &au : a) scanf ("%d %d",&au.first,&au.second);
                     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:9:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (auto &au : b) scanf ("%d",&au);
                     ~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...