61042023-10-29 22:33:12xxxZsonglőrködéscpp14Accepted 100/100104ms10804 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long 


signed main() {
            	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	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";
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1832 KiB
2Accepted3ms2044 KiB
subtask220/20
3Accepted4ms2400 KiB
4Accepted32ms4296 KiB
5Accepted76ms7444 KiB
6Accepted93ms8540 KiB
7Accepted104ms9324 KiB
8Accepted104ms9616 KiB
9Accepted103ms9288 KiB
10Accepted104ms9500 KiB
11Accepted104ms9708 KiB
subtask335/35
12Accepted3ms3836 KiB
13Accepted3ms3888 KiB
14Accepted3ms3892 KiB
15Accepted3ms3824 KiB
16Accepted3ms3828 KiB
17Accepted3ms4184 KiB
18Accepted3ms4384 KiB
19Accepted3ms4516 KiB
20Accepted3ms4588 KiB
subtask445/45
21Accepted3ms4600 KiB
22Accepted24ms6360 KiB
23Accepted76ms9116 KiB
24Accepted68ms10004 KiB
25Accepted104ms10528 KiB
26Accepted75ms10780 KiB
27Accepted104ms10804 KiB
28Accepted75ms10768 KiB
29Accepted103ms10764 KiB