69862023-12-23 22:09:40999Áruszállítás (75 pont)cpp17Wrong answer 0/75101ms22392 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
	int n,m;cin>>n>>m;
	vector<int> l(m),r(m),cnt(n+2);
	for(int i = 0;i<m;i++){
		cin>>l[i]>>r[i];
		cnt[l[i]]++;
		cnt[r[i+1]]--;
	}int ans=0;
	for(int i = 1;i<=n;i++){
		cnt[i]+=cnt[i-1];
		if(cnt[i]==0)ans++;
	}
	cout<<ans<<endl;
}
SubtaskSumTestVerdictTimeMemory
base0/75
1Accepted0/03ms1816 KiB
2Wrong answer0/0101ms20952 KiB
3Wrong answer0/33ms2412 KiB
4Wrong answer0/33ms2436 KiB
5Wrong answer0/32ms2528 KiB
6Wrong answer0/33ms2520 KiB
7Wrong answer0/33ms2652 KiB
8Wrong answer0/43ms2892 KiB
9Wrong answer0/43ms3144 KiB
10Wrong answer0/43ms3328 KiB
11Wrong answer0/43ms4184 KiB
12Wrong answer0/44ms4664 KiB
13Wrong answer0/48ms5044 KiB
14Wrong answer0/49ms6552 KiB
15Wrong answer0/48ms6680 KiB
16Wrong answer0/410ms8712 KiB
17Wrong answer0/413ms10540 KiB
18Wrong answer0/413ms12056 KiB
19Wrong answer0/413ms10504 KiB
20Wrong answer0/414ms12052 KiB
21Wrong answer0/489ms22336 KiB
22Wrong answer0/490ms22392 KiB