21502022-12-25 12:00:08bzsofiaÁruszállítás üres szakaszaicpp11Wrong answer 14/5039ms19132 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];
    }

    for (i = 1; i <= m; ++i)
    {
        akt += x[i];

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

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

    cout << db;
}
SubtaskSumTestVerdictTimeMemory
base14/50
1Accepted0/03ms2012 KiB
2Wrong answer0/032ms17664 KiB
3Accepted2/22ms2620 KiB
4Wrong answer0/22ms2416 KiB
5Accepted2/22ms2600 KiB
6Accepted2/22ms2680 KiB
7Accepted2/22ms2680 KiB
8Accepted2/22ms2920 KiB
9Wrong answer0/22ms2992 KiB
10Wrong answer0/22ms2960 KiB
11Accepted2/22ms3788 KiB
12Accepted2/23ms4420 KiB
13Wrong answer0/34ms4620 KiB
14Wrong answer0/34ms6280 KiB
15Wrong answer0/34ms6132 KiB
16Wrong answer0/327ms19120 KiB
17Wrong answer0/325ms19072 KiB
18Wrong answer0/327ms19072 KiB
19Wrong answer0/36ms9588 KiB
20Wrong answer0/38ms11144 KiB
21Wrong answer0/330ms19072 KiB
22Wrong answer0/339ms19132 KiB