19502022-12-12 12:53:15DragonoidOmegaÁruszállítás üres szakaszaicpp11Wrong answer 18/5086ms19012 KiB
#include <iostream>
#include <vector>

using namespace std;
int i,n,m,a,b,db;
int main()
{
    cin>>n>>m;
    vector <long long> x(n+2);
    for(i=1;i<=m;++i)
    {
        cin>>a>>b;
        x[a]++;
        x[b+1]--;
    }
    ++n;
    --db;
    for(i=1;i<=n;++i)
    {
        x[i]+=x[i-1];
        if(x[i]==0 && x[i-1]!=0) db++;
    }
    if(x[1]==0) ++db;
    cout<<db;
}
SubtaskSumTestVerdictTimeMemory
base18/50
1Wrong answer0/03ms1812 KiB
2Accepted0/086ms17524 KiB
3Wrong answer0/22ms2220 KiB
4Accepted2/22ms2420 KiB
5Wrong answer0/22ms2772 KiB
6Wrong answer0/22ms2900 KiB
7Wrong answer0/22ms3092 KiB
8Wrong answer0/22ms3172 KiB
9Accepted2/22ms3108 KiB
10Accepted2/22ms3220 KiB
11Wrong answer0/23ms3876 KiB
12Wrong answer0/23ms4524 KiB
13Wrong answer0/37ms4500 KiB
14Wrong answer0/38ms6056 KiB
15Wrong answer0/38ms6060 KiB
16Accepted3/365ms18796 KiB
17Accepted3/367ms18792 KiB
18Accepted3/375ms18952 KiB
19Wrong answer0/313ms9464 KiB
20Wrong answer0/314ms11132 KiB
21Wrong answer0/379ms19012 KiB
22Accepted3/382ms19012 KiB