216642026-01-13 17:53:13algoproÁruszállítás üres szakaszaicpp17Wrong answer 9/50400ms4196 KiB
// UUID: 2a9297ae-c665-4e7d-a39b-0e0124e5cdda
#include <bits/stdc++.h>
using namespace std;

int main() {
	//cout << "Hello world!\n";
	int n,k;
	cin>>n>>k;
	vector<int> v(n);
	for(int i = 0;i<k;i++){
		int a,b;
		cin>>a>>b;
		for(int j = a+1;j<b;j++){
			v[j]++;
		}
	}
	int ans = 0;
	for(int i = 0;i<n;i++){
		if(v[i] == 0){
			bool jo = true;
			while(i<n && jo){
				if(v[i] != 0) jo=false;
				i++;
			}
			ans++;
		}
	}
	cout<<ans;
}
SubtaskSumTestVerdictTimeMemory
base9/50
1Accepted0/01ms316 KiB
2Accepted0/096ms4148 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms512 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Accepted2/21ms316 KiB
8Wrong answer0/21ms316 KiB
9Accepted2/21ms508 KiB
10Wrong answer0/21ms316 KiB
11Accepted2/21ms564 KiB
12Wrong answer0/22ms564 KiB
13Wrong answer0/34ms548 KiB
14Wrong answer0/38ms1128 KiB
15Wrong answer0/34ms1076 KiB
16Time limit exceeded0/3400ms4196 KiB
17Time limit exceeded0/3400ms4148 KiB
18Time limit exceeded0/3398ms4148 KiB
19Wrong answer0/38ms1844 KiB
20Wrong answer0/39ms2356 KiB
21Wrong answer0/379ms4148 KiB
22Accepted3/382ms4148 KiB