Submission #110384

#TimeUsernameProblemLanguageResultExecution timeMemory
110384luciocfExhibition (JOI19_ho_t2)C++14
100 / 100
135 ms4552 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5+10; struct P { int s, v; } p[maxn]; int suf[maxn]; int c[maxn]; int n, m; bool comp(P a, P b) { if (a.v == b.v) return a.s < b.s; return a.v < b.v; } int main(void) { scanf("%d %d", &n, &m); for (int i = 1; i <= n; i++) scanf("%d %d", &p[i].s, &p[i].v); for (int i = 1; i <= m; i++) scanf("%d", &c[i]); sort(p+1, p+n+1, comp); sort(c+1, c+m+1); int ans = 0, ptr = n; for (int i = m; i >= 1; i--) { for (; ptr >= 1 && p[ptr].s > c[i]; ptr--); if (ptr >= 1) { ans++; ptr--; } } printf("%d\n", ans); }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:26: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:29:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &p[i].s, &p[i].v);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:32:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &c[i]);
   ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...