75202024-01-09 13:18:20TuruTamasÁruszállítás üres szakaszaicpp17Wrong answer 14/5086ms20848 KiB
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

typedef long long ll;

ll N, M, a, b, r, valsum;
ll tomb[1000000];

int main()
{
    cin >> N >> M;
    for (ll m = 0; m < M; m++) {
        cin >> a >> b;
        a--; b--;
        tomb[a]++;
        tomb[b]--;
    }
    bool f = false;
    for (ll &val : tomb) {
        valsum += val;
        if (valsum == 0 && !f) {
            r++;
            f = true;
        }
        else if (val != 0) {
            f = false;
        }
    }
    cout << r << endl;
}
SubtaskSumTestVerdictTimeMemory
base14/50
1Accepted0/04ms1880 KiB
2Wrong answer0/086ms17720 KiB
3Accepted2/24ms2312 KiB
4Wrong answer0/24ms2396 KiB
5Accepted2/24ms2524 KiB
6Accepted2/24ms2612 KiB
7Accepted2/24ms2716 KiB
8Accepted2/24ms2924 KiB
9Wrong answer0/24ms3132 KiB
10Wrong answer0/24ms3348 KiB
11Accepted2/24ms3600 KiB
12Accepted2/26ms4884 KiB
13Wrong answer0/39ms5096 KiB
14Wrong answer0/312ms6492 KiB
15Wrong answer0/39ms6772 KiB
16Wrong answer0/361ms5460 KiB
17Wrong answer0/364ms5792 KiB
18Wrong answer0/371ms6104 KiB
19Wrong answer0/312ms11068 KiB
20Wrong answer0/313ms12924 KiB
21Wrong answer0/379ms20832 KiB
22Wrong answer0/381ms20848 KiB