21522022-12-25 12:08:22bzsofiaÁruszállítás üres szakaszaicpp11Wrong answer 14/5037ms19816 KiB
#include <iostream>
#include <vector>

using namespace std;

long long n, m, i, a, b, db;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin >> n >> m;

    vector <long long> x(n + 1);

    for (i = 1; i <= m; ++i)
    {
        cin >> a >> b;
        ++x[a];
        --x[b];
    }

    for (i=2; i<=n; ++i)
    {
        x[i]+=x[i-1];
    }

    x[0]=1;

    for (i=1; i<=n; ++i)
    {
        if (x[i-1]>0 && x[i]==0) ++db;
    }

    cout << db;
}
SubtaskSumTestVerdictTimeMemory
base14/50
1Accepted0/03ms1700 KiB
2Wrong answer0/035ms17496 KiB
3Accepted2/22ms2068 KiB
4Wrong answer0/22ms2292 KiB
5Accepted2/22ms2504 KiB
6Accepted2/22ms2676 KiB
7Accepted2/22ms2880 KiB
8Accepted2/22ms3112 KiB
9Wrong answer0/22ms3172 KiB
10Wrong answer0/22ms3172 KiB
11Accepted2/23ms3864 KiB
12Accepted2/23ms4384 KiB
13Wrong answer0/34ms4364 KiB
14Wrong answer0/36ms5916 KiB
15Wrong answer0/34ms6172 KiB
16Wrong answer0/328ms19128 KiB
17Wrong answer0/328ms19088 KiB
18Wrong answer0/332ms19396 KiB
19Wrong answer0/38ms10244 KiB
20Wrong answer0/39ms11928 KiB
21Wrong answer0/337ms19816 KiB
22Wrong answer0/337ms19748 KiB