18622022-12-06 09:27:35kdbÁruszállítás (75 pont)cpp11Accepted 75/7528ms11792 KiB
#include <iostream>
#include <vector>
#include <time.h>
using namespace std;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n, m;
	cin >> n >> m;
	vector<int> vec(n+1, 0);
	for (size_t i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		vec[a]++;
		vec[b]--;
	}
	int ossz = 0;
	int db = 0;
	for (size_t i = 1; i < n; i++)
	{
		ossz += vec[i];
		if (ossz == 0)
		{
			db++;
		}
	}
	cout << db << endl;
}
/*
10 4
8 9
1 6
1 3
3 4
*/
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms2100 KiB
2Accepted0/028ms9944 KiB
3Accepted3/32ms2436 KiB
4Accepted3/32ms2592 KiB
5Accepted3/32ms2572 KiB
6Accepted3/32ms2704 KiB
7Accepted3/32ms3052 KiB
8Accepted4/42ms3032 KiB
9Accepted4/42ms3040 KiB
10Accepted4/42ms3244 KiB
11Accepted4/42ms3752 KiB
12Accepted4/43ms4196 KiB
13Accepted4/44ms4260 KiB
14Accepted4/44ms4812 KiB
15Accepted4/44ms5072 KiB
16Accepted4/44ms6060 KiB
17Accepted4/44ms6840 KiB
18Accepted4/46ms7936 KiB
19Accepted4/44ms6976 KiB
20Accepted4/46ms7884 KiB
21Accepted4/426ms11780 KiB
22Accepted4/426ms11792 KiB