140542025-01-09 17:59:46miszorimarciÁruszállítás üres szakaszaicpp17Wrong answer 14/5079ms4148 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m; cin >> n >> m;
    vector<int>cnt(n+1);
    for(int i = 0; i < m; i++)
    {
        int a, b; cin >> a >> b;
        cnt[a]++, cnt[b]--;
    }

    int ans = 0;
    bool b = false;
    for(int i = 1; i <= n; i++)
    {
        cnt[i] += cnt[i-1];
        if(cnt[i] == 0)
        {
            b = true;
        }
        else if(b)
        {
            ans++;
            b = false;
        }
    }
    if(b)ans++;
    cout << ans;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base14/50
1Accepted0/01ms316 KiB
2Wrong answer0/076ms4148 KiB
3Accepted2/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms316 KiB
8Accepted2/21ms316 KiB
9Wrong answer0/21ms316 KiB
10Wrong answer0/21ms500 KiB
11Accepted2/21ms564 KiB
12Accepted2/22ms756 KiB
13Wrong answer0/34ms564 KiB
14Wrong answer0/37ms1076 KiB
15Wrong answer0/34ms1132 KiB
16Wrong answer0/361ms4148 KiB
17Wrong answer0/363ms4148 KiB
18Wrong answer0/371ms4148 KiB
19Wrong answer0/38ms1844 KiB
20Wrong answer0/39ms2356 KiB
21Wrong answer0/371ms4068 KiB
22Wrong answer0/379ms4148 KiB