201152026-01-02 09:16:05BikficcÁruszállítás üres szakaszaicpp17Wrong answer 0/5082ms4320 KiB
#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n, m, x, y;
    cin >> n >> m;
    vector <int> v(n+1);
    for (int i=1; i<=m; i++)
    {
        cin >> x >> y;
        v[x]++;
        v[y]--;
    }
    int sum=0, db;
    bool elozo=true;
    for (int i=1; i<=n; i++)
    {
        sum+=v[i];
        if (sum==0)
        {
            if (elozo)
            {
               db++;
               elozo=false;
            }
        }
        else
        {
            elozo=true;
        }
    }
    cout << db;
    return 0;
}

SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/082ms4148 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/21ms316 KiB
10Wrong answer0/21ms508 KiB
11Wrong answer0/21ms564 KiB
12Wrong answer0/22ms564 KiB
13Wrong answer0/34ms564 KiB
14Wrong answer0/37ms1076 KiB
15Wrong answer0/34ms1140 KiB
16Wrong answer0/361ms4320 KiB
17Wrong answer0/361ms4148 KiB
18Wrong answer0/370ms4148 KiB
19Wrong answer0/38ms1844 KiB
20Wrong answer0/310ms2356 KiB
21Wrong answer0/371ms4148 KiB
22Wrong answer0/372ms4172 KiB