168312025-05-13 18:36:23vargaviviÁruszállítás üres szakaszaicpp17Wrong answer 2/5083ms4332 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/01ms556 KiB
2Wrong answer0/083ms4148 KiB
3Wrong answer0/21ms316 KiB
4Accepted2/21ms316 KiB
5Wrong answer0/21ms500 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/21ms316 KiB
10Wrong answer0/21ms316 KiB
11Wrong answer0/21ms564 KiB
12Wrong answer0/22ms564 KiB
13Wrong answer0/34ms756 KiB
14Wrong answer0/38ms1076 KiB
15Wrong answer0/34ms1076 KiB
16Wrong answer0/361ms4320 KiB
17Wrong answer0/363ms4332 KiB
18Wrong answer0/371ms4180 KiB
19Wrong answer0/38ms1856 KiB
20Wrong answer0/39ms2356 KiB
21Wrong answer0/379ms4148 KiB
22Wrong answer0/372ms4152 KiB