75492024-01-09 14:03:35rennÁruszállítás üres szakaszaicpp17Wrong answer 12/5041ms19280 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);

    int n, m, a, b;
    cin >> n >> m;

    vector<int> csomagad(n, 0);
    vector<int> csomagvon(n, 0);
    while(m--)
    {
        cin >> a >> b;
        csomagad[a-1]++;
        csomagvon[b-1]++;
    }
    int uresszam = 0, t = 0;


    bool ures = true;

    for(int i = 0; i < n; i++)
    {
        t -= csomagvon[i];

        uresszam += (!ures && (t == 0));

        t += csomagad[i];

        ures = t == 0;
    }

    cout << uresszam << "\n";

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base12/50
1Accepted0/03ms2012 KiB
2Accepted0/041ms17572 KiB
3Wrong answer0/23ms2248 KiB
4Wrong answer0/23ms2464 KiB
5Wrong answer0/23ms2672 KiB
6Wrong answer0/23ms2744 KiB
7Wrong answer0/23ms2972 KiB
8Accepted2/23ms3180 KiB
9Wrong answer0/23ms3288 KiB
10Accepted2/23ms3336 KiB
11Wrong answer0/23ms3980 KiB
12Accepted2/24ms4760 KiB
13Wrong answer0/34ms4840 KiB
14Wrong answer0/36ms6532 KiB
15Wrong answer0/36ms6468 KiB
16Accepted3/329ms19124 KiB
17Wrong answer0/329ms19280 KiB
18Accepted3/332ms19136 KiB
19Wrong answer0/38ms9648 KiB
20Wrong answer0/38ms11152 KiB
21Wrong answer0/339ms19080 KiB
22Wrong answer0/337ms19084 KiB