21492022-12-25 11:55:19bzsofiaÁruszállítás üres szakaszaicpp11Wrong answer 14/5037ms19876 KiB
#include <iostream>
#include <vector>

using namespace std;

long long n, m, i, a, b, akt, db;
bool elozo;

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

    cin >> m >> n;

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

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

    x[0]=1;
    for (i = 1; i <= m; ++i)
    {
        if (i>1) x[i] += x[i-1];

        if (x[i] == 0 && x[i - 1] != 0)
        {
            ++db;
        }
    }

    //if (x[1] == 0) ++db;

    cout << db;
}
SubtaskSumTestVerdictTimeMemory
base14/50
1Accepted0/03ms1824 KiB
2Wrong answer0/037ms17692 KiB
3Accepted2/22ms2268 KiB
4Wrong answer0/22ms2456 KiB
5Accepted2/22ms2656 KiB
6Accepted2/22ms2712 KiB
7Accepted2/22ms2936 KiB
8Accepted2/22ms3036 KiB
9Wrong answer0/22ms3240 KiB
10Wrong answer0/22ms3480 KiB
11Accepted2/23ms4620 KiB
12Accepted2/23ms4820 KiB
13Wrong answer0/34ms5072 KiB
14Wrong answer0/36ms6584 KiB
15Wrong answer0/34ms6896 KiB
16Wrong answer0/328ms19524 KiB
17Wrong answer0/327ms19584 KiB
18Wrong answer0/329ms19712 KiB
19Wrong answer0/37ms10132 KiB
20Wrong answer0/38ms11700 KiB
21Wrong answer0/335ms19620 KiB
22Wrong answer0/334ms19876 KiB