#include<bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, m; cin >> n >> m;
set<pair<int, int>, greater<pair<int, int>>> a;
set<pair<int, int>> b;
vector<bool> dead(n);
deque<int> c(m);
for(int i=0; i<n; i++) {
int in; cin >> in;
a.insert({in, i});
}
for(int i=0; i<n; i++) {
int in; cin >> in;
b.insert({in, i});
}
for(int &p : c) cin >> p;
sort(c.begin(), c.end()); int ans=0;
for(auto [p, i] : a) {
if(c.empty()) break;
if(p>c.back()) continue;
dead[i]=1;
ans++; c.pop_back();
}
for(auto [p, i] : b) {
if(c.empty()) break;
if(dead[i]) continue;
if(p<c.front()) continue;
ans++; c.pop_front();
}
cout << ans << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
37 ms |
10188 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |