Submission #825899

# Submission time Handle Problem Language Result Execution time Memory
825899 2023-08-15T09:10:38 Z dijbkr Exhibition (JOI19_ho_t2) C++14
0 / 100
1 ms 212 KB
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

ll n,m;
pair<ll,ll>p[200005];
ll a[200005];

bool check(ll x) {
   ll pos=m-x+1;
   for (ll i=1; i<=n; i++) {
      if (p[i].second<=a[pos]) {
         pos++;
         if (pos==m+1) {
            return true;
         }
      }
   }
   return false;
}

ll bs() {
   ll ans=0;
   ll l=0;
   ll r=min(m,n);
   while (l<=r) {
      ll mid=(l+r)/2;
      if (check(mid)) {
         ans=mid;
         l=mid+1;
      } else {
         r=mid-1;
      }
   }
   return ans;
}

int main() {
   ios_base::sync_with_stdio(false);
   cin.tie(NULL); cout.tie(NULL);
   cin >> n >> m;
   for (ll i=1; i<=n; i++) {
      cin >> p[i].second >> p[i].first;
   }
   sort(p+1,p+n+1);
   for (ll i=1; i<=m; i++) {
      cin >> a[i];
   }
   sort(a+1,a+m+1);
   cout << bs();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -