64692023-12-02 17:54:55xxxÁruszállítás üres szakaszaicpp14Wrong answer 2/5079ms12232 KiB
#include <bits/stdc++.h>
using namespace std;

const int mxN = 1e6;

int trip[mxN+2];

int main() {
	int n, m;
	cin >> n >> m;
	for(int i  = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		trip[x]++;
		trip[y]--;
	}
	for(int i = 2; i < n; i++) {
		trip[i] += trip[i-1];
	}

	bool now = false;
	int ans = 0;

	for(int i = 2; i < n; i++) {
		if (trip[i-1] != 0 && trip[i] == 0) {
			ans++;
		}
	}



	if (trip[1] != 0) cout << ans << '\n';
	else cout << ans-1 << '\n';
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Accepted0/03ms1888 KiB
2Wrong answer0/079ms9984 KiB
3Wrong answer0/23ms2324 KiB
4Accepted2/23ms2416 KiB
5Wrong answer0/23ms2540 KiB
6Wrong answer0/23ms2752 KiB
7Wrong answer0/23ms3116 KiB
8Wrong answer0/23ms3144 KiB
9Wrong answer0/23ms3352 KiB
10Wrong answer0/23ms3560 KiB
11Wrong answer0/23ms4264 KiB
12Wrong answer0/23ms4776 KiB
13Wrong answer0/37ms4612 KiB
14Wrong answer0/38ms5348 KiB
15Wrong answer0/37ms5392 KiB
16Wrong answer0/364ms12064 KiB
17Wrong answer0/365ms12136 KiB
18Wrong answer0/374ms12160 KiB
19Wrong answer0/310ms7340 KiB
20Wrong answer0/312ms8116 KiB
21Wrong answer0/371ms12232 KiB
22Wrong answer0/375ms12224 KiB