# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
995466 | SuPythony | Exhibition (JOI19_ho_t2) | C++17 | 1 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n,m; cin>>n>>m;
vector<pair<int,int>> a;
for (int i=0; i<n; i++) {
int s,v; cin>>s>>v;
a.push_back({v,s});
}
vector<int> c(m);
for (auto &i: c) cin>>i;
sort(a.begin(),a.end());
sort(c.begin(),c.end());
vector<int> s;
for (auto i: a) s.push_back(i.second);
vector<int> lbs;
for (int i=0; i<n; i++) {
auto p=lower_bound(c.begin(),c.end(),s[i]);
if (p==c.end()) continue;
lbs.push_back(p-c.begin());
}
vector<int> l;
int mn;
for (int i=0; i<lbs.size(); i++) {
auto p=upper_bound(l.begin(),l.end(),lbs[i]);
if (p==l.end()) {
l.push_back(lbs[i]);
mn=lbs[0];
} else {
*p=lbs[i];
}
}
cout<<min(m-mn,(int)l.size());
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |