Submission #364723

# Submission time Handle Problem Language Result Execution time Memory
364723 2021-02-09T20:07:21 Z tushar_2658 Exhibition (JOI19_ho_t2) C++14
0 / 100
1 ms 364 KB
#include "bits/stdc++.h"
using namespace std;

const int maxn = 200005;
using ll = long long;

pair<ll, ll> p[maxn];
ll c[maxn];

int main(int argc, char const *argv[])
{
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n, m;
  cin >> n >> m;
  for(int i = 1; i <= n; ++i){
    cin >> p[i].first >> p[i].second;
  }
  for(int i = 1; i <= m; ++i){
    cin >> c[i];
  }
  sort(p + 1, p + n + 1, [&](pair<int, int> x, pair<int, int> y){
    return x.second < y.second;
  });
  sort(c + 1, c + m + 1); 
  int ptr = n, ans = 0; 
  for(int i = m; i > 0 && ptr > 0; --i){
    while(ptr > 0 && p[ptr].first > c[i]){
      --ptr;
    }
    if(ptr > 0 && p[ptr].first <= c[i]){
      ++ans;
      --ptr;
    }
  }
  cout << ans << '\n';

  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -