#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define AquA cin.tie(0);ios_base::sync_with_stdio(0);
#define fs first
#define sc second
#define cd complex<double>
#define p_q priority_queue
using namespace std;
int main(){
AquA;
int n,m;
cin >> n >> m;
vector<pair<int,int> > v(n);
vector<int> p(m);
for(int i=0;i<n;i++){
cin >> v[i].sc >> v[i].fs;
}
sort(v.begin(),v.end());
for(int i=0;i<m;i++){
cin >> p[i];
}
sort(p.begin(),p.end());
assert(n<=10);
int ans=0;
for(int i=0;i<(1<<n);i++){
vector<int> h;
for(int j=0;j<n;j++){
if((i>>j)&1){
h.push_back(v[j].sc);
}
}
int nw=0;
int flag=0;
/*
for(int i=0;i<(int)h.size()-1;i++){
if(h[i]>h[i+1]){
flag=1;
break;
}
}
*/
for(auto y:h){
if(nw==m){
flag=1;
break;
}
while(nw<m){
if(p[nw]>=y){
nw++;
break;
}
nw++;
}
}
if(flag==0){
ans=max(ans,(int)h.size());
}
}
cout << ans << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |