Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- const int N = 1004;
- int n, a[N], b[N], tmp[N];
- void sol() {
- sort(a+1, a+n+1); reverse(a+1, a+n+1);
- sort(b+1, b+n+1);
- int res = 0;
- for (int win = n; win >= 1; --win) {
- for (int i = 1; i <= win; ++i) tmp[i] = a[i];
- reverse(tmp+1, tmp+win+1);
- int Count = 0;
- for (int i = 1; i <= win; ++i) {
- if (tmp[i] > b[i]) Count++;
- }
- res = max(res, Count);
- }
- cout << res << '\n';
- }
- int main() {
- ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
- //freopen("horse.inp", "r", stdin);
- //freopen("horse.out", "w", stdout);
- freopen("input.txt", "r", stdin);
- cin >> n;
- for (int i = 1; i <= n; ++i) cin >> a[i];
- for (int i = 1; i <= n; ++i) cin >> b[i];
- sol();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement