224042026-01-15 07:17:31bombinigusiniÁruszállítás üres szakaszaicpp17Wrong answer 15/50400ms4340 KiB
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
    int n, m;
    cin>>n>>m;
    vector <int> t(n, 0);
    int a, b;
    for (int i=0; i<m; i++)
    {
        cin>>a>>b;
        for(int j=a-1; j<=b-1; j++)
        {
            t[j]=1;
        }
    }
    int ures=0;
    if(t[0]==0) ures++;
    for(int i=1; i<n; i++)
    {
        if(t[i]==0 and t[i-1]!=0)
        {
            ures++;
        }
    }
    cout<<ures;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/01ms316 KiB
2Accepted0/096ms4148 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Accepted2/21ms316 KiB
8Wrong answer0/21ms316 KiB
9Accepted2/21ms316 KiB
10Accepted2/21ms316 KiB
11Accepted2/21ms564 KiB
12Wrong answer0/22ms564 KiB
13Wrong answer0/36ms564 KiB
14Wrong answer0/38ms1076 KiB
15Wrong answer0/36ms1076 KiB
16Time limit exceeded0/3400ms4340 KiB
17Time limit exceeded0/3400ms4148 KiB
18Time limit exceeded0/3400ms4148 KiB
19Wrong answer0/39ms1844 KiB
20Wrong answer0/310ms2356 KiB
21Wrong answer0/379ms4148 KiB
22Accepted3/382ms4148 KiB