59032023-10-05 12:09:50mmatedÁruszállítás üres szakaszaicpp11Wrong answer 27/50375ms12184 KiB
#include <bits/stdc++.h>
using namespace std;

void solve()
{
    int n,m;
    cin>>n>>m;
    int a[n]={0};
    int kezd, veg;
    for(int i=0; i<m; i++)
    {
        cin>>kezd>>veg;
        for(int j=kezd; j<veg; j++)
            a[j]=1;
    }
    int c=0;
    if(a[0]==1)    c++;
    for(int i=1; i<n; i++)
    {
        if(a[i]==1 && a[i+1]==0)  c++;
    }
    cout<<c;
}

int main()
{
    solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base27/50
1Accepted0/03ms1772 KiB
2Accepted0/085ms9864 KiB
3Wrong answer0/22ms2208 KiB
4Accepted2/23ms2452 KiB
5Wrong answer0/23ms2668 KiB
6Wrong answer0/23ms2904 KiB
7Wrong answer0/23ms3124 KiB
8Wrong answer0/22ms3204 KiB
9Accepted2/23ms3264 KiB
10Accepted2/23ms3484 KiB
11Wrong answer0/23ms3920 KiB
12Wrong answer0/23ms4176 KiB
13Accepted3/37ms4452 KiB
14Accepted3/38ms5128 KiB
15Accepted3/37ms5132 KiB
16Time limit exceeded0/3375ms7072 KiB
17Time limit exceeded0/3374ms7068 KiB
18Time limit exceeded0/3354ms7492 KiB
19Accepted3/39ms7524 KiB
20Accepted3/312ms8328 KiB
21Accepted3/375ms12184 KiB
22Accepted3/379ms12140 KiB