Submission #478561

#TimeUsernameProblemLanguageResultExecution timeMemory
478561Mackerel_PikeExhibition (JOI19_ho_t2)C++14
100 / 100
65 ms1492 KiB
#include <bits/stdc++.h>

using namespace std;

#define fst first
#define snd second

const int maxn = 1e5 + 5;

int n, m;
int c[maxn];
pair<int, int> a[maxn];

int main(){
  //freopen("a.in", "r", stdin);
  //freopen("a.out", "w", stdout);
  
  scanf("%d%d", &n, &m);
  for(int i = 0; i < n; ++i)
    scanf("%d%d", &a[i].snd, &a[i].fst);
  for(int i = 0; i < m; ++i)
    scanf("%d", c + i);

  sort(a, a + n);
  sort(c, c + m);

  int ans = 0;
  for(int i = m - 1, j = n - 1; i >= 0; --i){
    for(; j >= 0 && a[j].snd > c[i]; --j);
    if(j < 0)
      break;
    else
      ++ans, --j;
  }

  printf("%d\n", ans);
  return 0;
}
  

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   scanf("%d%d", &n, &m);
      |   ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     scanf("%d%d", &a[i].snd, &a[i].fst);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     scanf("%d", c + i);
      |     ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...