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

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> trip(n+10);
	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/03ms1808 KiB
2Wrong answer0/079ms9784 KiB
3Wrong answer0/23ms2276 KiB
4Accepted2/22ms2304 KiB
5Wrong answer0/23ms2428 KiB
6Wrong answer0/23ms2644 KiB
7Wrong answer0/23ms2848 KiB
8Wrong answer0/23ms2972 KiB
9Wrong answer0/23ms3180 KiB
10Wrong answer0/23ms3264 KiB
11Wrong answer0/23ms3608 KiB
12Wrong answer0/23ms4004 KiB
13Wrong answer0/37ms4256 KiB
14Wrong answer0/38ms4804 KiB
15Wrong answer0/37ms5056 KiB
16Wrong answer0/364ms11440 KiB
17Wrong answer0/365ms11408 KiB
18Wrong answer0/374ms11636 KiB
19Wrong answer0/310ms7312 KiB
20Wrong answer0/313ms8096 KiB
21Wrong answer0/378ms11748 KiB
22Wrong answer0/375ms11888 KiB