Submission #747555

# Submission time Handle Problem Language Result Execution time Memory
747555 2023-05-24T10:17:01 Z tch1cherin Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, M;
  cin >> N >> M;
  vector<int> S(N), V(N);
  for (int i = 0; i < N; i++) {
    cin >> S[i] >> V[i];
  }
  vector<int> C(M);
  for (int i = 0; i < M; i++) {
    cin >> C[i];
  }
  sort(C.begin(), C.end());
  vector<int> p(N);
  iota(p.begin(), p.end(), 0);
  sort(p.begin(), p.end(), [&](int i, int j) {
    return V[i] < V[j];
  });
  vector<int> suff(N);
  for (int i = N - 1; i >= 0; i--) {
    suff[i] = (int)C.size() - (lower_bound(C.begin(), C.end(), S[i]) - C.begin());
  }
  reverse(suff.begin(), suff.end());
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (suff[i] > ans) {
      ans++;
    }
  }
  cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -