64682023-12-02 17:53:41xxxÁruszállítás üres szakaszaicpp14Wrong answer 0/5081ms12076 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 = 1; 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
base0/50
1Accepted0/03ms2144 KiB
2Wrong answer0/081ms10152 KiB
3Wrong answer0/22ms2288 KiB
4Wrong answer0/23ms2412 KiB
5Wrong answer0/22ms2632 KiB
6Wrong answer0/23ms3004 KiB
7Wrong answer0/23ms3080 KiB
8Wrong answer0/23ms3316 KiB
9Wrong answer0/23ms3332 KiB
10Wrong answer0/23ms3440 KiB
11Wrong answer0/23ms3772 KiB
12Wrong answer0/24ms4032 KiB
13Wrong answer0/37ms4280 KiB
14Wrong answer0/38ms4980 KiB
15Wrong answer0/37ms4980 KiB
16Wrong answer0/365ms11628 KiB
17Wrong answer0/367ms11840 KiB
18Wrong answer0/375ms12024 KiB
19Wrong answer0/310ms7152 KiB
20Wrong answer0/312ms8144 KiB
21Wrong answer0/375ms12076 KiB
22Wrong answer0/375ms12076 KiB