Submission #1023887

#TimeUsernameProblemLanguageResultExecution timeMemory
1023887lmaobruhExhibition (JOI19_ho_t2)C++14
100 / 100
44 ms4532 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int N = 1e6+5;

#define pii pair<int, int>
#define fi first
#define se second

int n, m, c[N];
pii a[N];

void sol() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i].fi >> a[i].se;
  for (int i = 1; i <= m; ++i) cin >> c[i];
  sort(c+1, c+m+1);
  sort(a+1, a+n+1, [&](pii &p1, pii &p2) -> bool {
    if (p1==p2) return 0;
    else if (p1.se == p2.se) return p1.fi < p2.fi;
    else return p1.se < p2.se;
  });
  int j = m;
  for (int i = n; min(i, j) >= 1; --i)
    if (a[i].fi <= c[j])
      j--;
  cout << m-j;
}

signed main() {
  cin.tie(0) -> sync_with_stdio(0);
  if (fopen("A.inp", "r")) freopen("A.inp", "r", stdin);
  int tc = 1; // cin >> tc;
  for (int test = 1; test <= tc; ++test) sol();
}

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:33:35: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |   if (fopen("A.inp", "r")) freopen("A.inp", "r", stdin);
      |                            ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...