Submission #99005

#TimeUsernameProblemLanguageResultExecution timeMemory
99005aintaExhibition (JOI19_ho_t2)C++17
100 / 100
95 ms1656 KiB
#include<cstdio>
#include<algorithm>
using namespace std;
#define N_ 101000
int C[N_];
struct point {
	int a, b;
	bool operator<(const point &p)const {
		return b != p.b ? b < p.b : a < p.a;
	}
}w[N_];
int n, m, res;
int main() {
	int i, j;
	scanf("%d%d", &n, &m);
	for (i = 1; i <= n; i++) {
		scanf("%d%d", &w[i].a, &w[i].b);
	}
	for (i = 1; i <= m; i++)scanf("%d", &C[i]);
	sort(w + 1, w + n + 1);
	sort(C + 1, C + m + 1);
	int pv = n;
	for (i = m; i >= 1; i--) {
		while (pv >= 1 && w[pv].a > C[i])pv--;
		if (pv) {
			res++;
			pv--;
		}
	}
	printf("%d\n", res);
}

Compilation message (stderr)

joi2019_ho_t3.cpp: In function 'int main()':
joi2019_ho_t3.cpp:14:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j;
         ^
joi2019_ho_t3.cpp:15: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_t3.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &w[i].a, &w[i].b);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t3.cpp:19:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (i = 1; i <= m; i++)scanf("%d", &C[i]);
                          ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...