36512023-03-01 18:33:23nkdorka1212Áruszállítás üres szakaszaicpp17Wrong answer 14/5081ms12544 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    vector<int>v(n+1,0);
    for(int i=1;i<=m;i++)
    {
        int a,b;
        cin>>a>>b;
        v[a]++;
        v[b]--;
    }
    for(int i=1;i<=n;i++)
    {
        v[i]+=v[i-1];
    }
    int cnt=0;
    v[0]=1;
    for(int i=1;i<=n;i++)
    {
        if(v[i-1]!=0 && v[i]==0)
        {
            cnt++;
        }
    }
    cout<<cnt<<"\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base14/50
1Accepted0/03ms1684 KiB
2Wrong answer0/081ms9576 KiB
3Accepted2/23ms2064 KiB
4Wrong answer0/23ms2280 KiB
5Accepted2/23ms2492 KiB
6Accepted2/23ms2576 KiB
7Accepted2/23ms2704 KiB
8Accepted2/23ms2912 KiB
9Wrong answer0/23ms3152 KiB
10Wrong answer0/23ms3244 KiB
11Accepted2/23ms3656 KiB
12Accepted2/24ms4260 KiB
13Wrong answer0/37ms4472 KiB
14Wrong answer0/38ms5332 KiB
15Wrong answer0/37ms5288 KiB
16Wrong answer0/364ms11652 KiB
17Wrong answer0/365ms11940 KiB
18Wrong answer0/372ms11896 KiB
19Wrong answer0/310ms7220 KiB
20Wrong answer0/313ms8452 KiB
21Wrong answer0/372ms12544 KiB
22Wrong answer0/379ms12484 KiB