6103 | 2023-10-29 22:30:45 | xxx | Zsonglőrködés | cpp14 | Accepted 100/100 | 226ms | 10720 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n;
cin >> n;
vector<int> a(n), b(n);
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
int l = 0, r = 0, ans = 0;
while(l < n && r < n) {
if (a[l] < b[r]) {
l++;
} else if (a[l] > b[r]) {
r++;
} else if (a[l] == b[r]) {
l++, r++, ans++;
}
}
cout << n-ans << "\n";
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1684 KiB | ||||
2 | Accepted | 3ms | 1928 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 4ms | 2204 KiB | ||||
4 | Accepted | 68ms | 4260 KiB | ||||
5 | Accepted | 168ms | 7160 KiB | ||||
6 | Accepted | 202ms | 8312 KiB | ||||
7 | Accepted | 224ms | 9160 KiB | ||||
8 | Accepted | 224ms | 9200 KiB | ||||
9 | Accepted | 226ms | 9204 KiB | ||||
10 | Accepted | 224ms | 9332 KiB | ||||
11 | Accepted | 224ms | 9524 KiB | ||||
subtask3 | 35/35 | ||||||
12 | Accepted | 2ms | 3388 KiB | ||||
13 | Accepted | 3ms | 3384 KiB | ||||
14 | Accepted | 3ms | 3580 KiB | ||||
15 | Accepted | 3ms | 3576 KiB | ||||
16 | Accepted | 3ms | 3560 KiB | ||||
17 | Accepted | 3ms | 3560 KiB | ||||
18 | Accepted | 3ms | 3564 KiB | ||||
19 | Accepted | 3ms | 3684 KiB | ||||
20 | Accepted | 3ms | 3768 KiB | ||||
subtask4 | 45/45 | ||||||
21 | Accepted | 4ms | 4016 KiB | ||||
22 | Accepted | 61ms | 5812 KiB | ||||
23 | Accepted | 167ms | 8544 KiB | ||||
24 | Accepted | 175ms | 9712 KiB | ||||
25 | Accepted | 224ms | 10312 KiB | ||||
26 | Accepted | 197ms | 10512 KiB | ||||
27 | Accepted | 223ms | 10472 KiB | ||||
28 | Accepted | 194ms | 10512 KiB | ||||
29 | Accepted | 224ms | 10720 KiB |