113202024-08-08 13:59:57bzyÁruszállítás (75 pont)cpp17Accepted 75/7583ms8164 KiB
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
	cin >> n >> m;
	int A[n+1] = {0};
	for(int i = 0; i<m;i++){
		int start; int end;
		cin >> start >> end;
		A[start] ++;
		A[end] --; 
	}
	int c = 0;
	int ans = 0;
	int B[n+1] = {0};
	for(int i = 1;i<n;i++){
		c += A[i];
		B[i] += c;
		if(B[i] == 0) ans++;
	}
	cout<<ans;
	
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/02ms356 KiB
2Accepted0/082ms8164 KiB
3Accepted3/33ms356 KiB
4Accepted3/33ms356 KiB
5Accepted3/32ms356 KiB
6Accepted3/33ms356 KiB
7Accepted3/32ms228 KiB
8Accepted4/43ms356 KiB
9Accepted4/43ms356 KiB
10Accepted4/43ms484 KiB
11Accepted4/43ms756 KiB
12Accepted4/44ms1260 KiB
13Accepted4/47ms928 KiB
14Accepted4/48ms1796 KiB
15Accepted4/47ms1716 KiB
16Accepted4/49ms2576 KiB
17Accepted4/49ms3428 KiB
18Accepted4/410ms4216 KiB
19Accepted4/412ms3488 KiB
20Accepted4/413ms4344 KiB
21Accepted4/483ms8112 KiB
22Accepted4/483ms8092 KiB