168322025-05-13 18:38:02vargaviviÁruszállítás üres szakaszaicpp17Wrong answer 2/5090ms4324 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> diff(n + 1);
	for (int i = 0; i < m; i ++) {
		int x, y;
		cin >> x >> y;
		diff[x] ++;
		diff[y] --;
	}
	int sum = 0, ans = 0;
	for (int i = 1; i < n; i ++) {
		sum += diff[i];
		if (sum == 0 && diff[i] != 0) ans ++;
	}
	cout << ans;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Accepted0/01ms316 KiB
2Wrong answer0/090ms4148 KiB
3Wrong answer0/21ms508 KiB
4Accepted2/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/21ms316 KiB
10Wrong answer0/21ms316 KiB
11Wrong answer0/21ms804 KiB
12Wrong answer0/21ms628 KiB
13Wrong answer0/34ms564 KiB
14Wrong answer0/37ms1076 KiB
15Wrong answer0/34ms1132 KiB
16Wrong answer0/361ms4320 KiB
17Wrong answer0/361ms4152 KiB
18Wrong answer0/370ms4148 KiB
19Wrong answer0/38ms1844 KiB
20Wrong answer0/39ms2368 KiB
21Wrong answer0/376ms4324 KiB
22Wrong answer0/381ms4148 KiB