36502023-03-01 18:31:24nkdorka1212Áruszállítás üres szakaszaicpp17Wrong answer 34/5081ms11668 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;
    for(int i=1;i<=n;i++)
    {
        if(v[i-1]!=0 && v[i]==0)
        {
            cnt++;
        }
    }
    cout<<cnt<<"\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base34/50
1Accepted0/03ms1812 KiB
2Accepted0/081ms9780 KiB
3Wrong answer0/23ms2232 KiB
4Wrong answer0/23ms2320 KiB
5Wrong answer0/23ms2444 KiB
6Wrong answer0/23ms2660 KiB
7Wrong answer0/22ms2740 KiB
8Wrong answer0/23ms2740 KiB
9Accepted2/23ms2872 KiB
10Accepted2/23ms3084 KiB
11Wrong answer0/23ms3604 KiB
12Wrong answer0/23ms4080 KiB
13Accepted3/37ms3956 KiB
14Accepted3/38ms4604 KiB
15Accepted3/37ms4624 KiB
16Accepted3/364ms11280 KiB
17Accepted3/367ms11440 KiB
18Accepted3/374ms11468 KiB
19Accepted3/310ms6932 KiB
20Accepted3/313ms7696 KiB
21Accepted3/374ms11468 KiB
22Accepted3/375ms11668 KiB