140452025-01-09 17:55:58miszorimarciÁruszállítás üres szakaszaicpp17Wrong answer 14/5083ms4332 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(!b && cnt[i] == 0)
        {
            ans++;
            b = true;
        }
        if(cnt[i] != 0 && b)b = false;
    }
    cout << ans;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base14/50
1Accepted0/01ms500 KiB
2Wrong answer0/083ms4160 KiB
3Accepted2/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms500 KiB
7Accepted2/21ms316 KiB
8Accepted2/21ms316 KiB
9Wrong answer0/21ms316 KiB
10Wrong answer0/21ms316 KiB
11Accepted2/21ms576 KiB
12Accepted2/22ms564 KiB
13Wrong answer0/34ms564 KiB
14Wrong answer0/37ms1000 KiB
15Wrong answer0/34ms1076 KiB
16Wrong answer0/361ms4148 KiB
17Wrong answer0/363ms4096 KiB
18Wrong answer0/371ms4148 KiB
19Wrong answer0/38ms1844 KiB
20Wrong answer0/39ms2356 KiB
21Wrong answer0/374ms4332 KiB
22Wrong answer0/374ms4148 KiB