20182022-12-14 10:47:18bzsofiaÁruszállítás üres szakaszaicpp11Wrong answer 34/5035ms20000 KiB

// Áruszállítás üres szakaszai.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#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)
    {
        x[i] += x[i-1];
        //cout << x[i] << " ";
        if (x[i] == 0 && x[i - 1] != 0)
        {
            ++db;
        }
    }

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

    cout << db;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base34/50
1Accepted0/03ms1832 KiB
2Accepted0/035ms17688 KiB
3Wrong answer0/22ms2220 KiB
4Wrong answer0/22ms2424 KiB
5Wrong answer0/22ms2632 KiB
6Wrong answer0/22ms2732 KiB
7Wrong answer0/22ms2940 KiB
8Wrong answer0/22ms3036 KiB
9Accepted2/22ms3244 KiB
10Accepted2/22ms3364 KiB
11Wrong answer0/23ms4400 KiB
12Wrong answer0/23ms4860 KiB
13Accepted3/34ms4836 KiB
14Accepted3/36ms6392 KiB
15Accepted3/34ms6392 KiB
16Accepted3/328ms19384 KiB
17Accepted3/328ms19588 KiB
18Accepted3/330ms19800 KiB
19Accepted3/38ms10048 KiB
20Accepted3/38ms11868 KiB
21Accepted3/335ms20000 KiB
22Accepted3/334ms19948 KiB