79902024-01-12 09:44:04csaron71Áruszállítás üres szakaszaicpp17Wrong answer 2/5081ms19444 KiB
#include <bits/stdc++.h>

using namespace std;



int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> plusz(n+1, 0);
    for (int i=0; i<m; i++) {
        int x, y;
        cin>>x>>y;
        plusz[x]++;
        plusz[y+1]--;
    }

    int vege=0, epp=0;
    for(int i=1; i<=n; i++) {

        epp+=plusz[i];
        if (epp==0) {
            vege++;
        }
    }
    cout << vege << "\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Accepted0/03ms1808 KiB
2Wrong answer0/081ms11136 KiB
3Wrong answer0/23ms3700 KiB
4Accepted2/23ms3924 KiB
5Wrong answer0/23ms4012 KiB
6Wrong answer0/23ms4012 KiB
7Wrong answer0/23ms4152 KiB
8Wrong answer0/23ms4388 KiB
9Wrong answer0/23ms4464 KiB
10Wrong answer0/23ms4584 KiB
11Wrong answer0/23ms4980 KiB
12Wrong answer0/23ms5432 KiB
13Wrong answer0/37ms5712 KiB
14Wrong answer0/38ms6676 KiB
15Wrong answer0/37ms6528 KiB
16Wrong answer0/361ms14200 KiB
17Wrong answer0/364ms15228 KiB
18Wrong answer0/371ms16456 KiB
19Wrong answer0/39ms12168 KiB
20Wrong answer0/310ms13164 KiB
21Wrong answer0/371ms18212 KiB
22Wrong answer0/375ms19444 KiB