19982022-12-13 07:51:20szabel26Áruszállítás üres szakaszaicpp17Wrong answer 34/5090ms27008 KiB
#include <iostream>
//#include <fstream>
#include <vector>

using namespace std;

//ifstream cin("aruszallitas.in");
//ofstream cout("aruszallitas.out");

struct szallit{
    int fel, le, adb;
};

int i,n,m,a,b,db;

vector<szallit>x;

int main()
{
    cin>>n>>m;
    x.resize(n+1);
    for(i=1;i<=m;++i)
    {
        cin>>a>>b;
        ++x[a].fel;
        ++x[b].le;
    }
    for(i=1;i<=n;++i)
    {
        x[i].adb=x[i-1].adb;
        if(x[i].fel!=0) x[i].adb+=x[i].fel;
        if(x[i].le!=0) x[i].adb-=x[i].le;
        if(x[i].adb==0 && x[i].adb!=x[i-1].adb) ++db;
    }
    cout<<db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base34/50
1Accepted0/03ms1876 KiB
2Accepted0/090ms25512 KiB
3Wrong answer0/22ms2332 KiB
4Wrong answer0/22ms2472 KiB
5Wrong answer0/22ms2696 KiB
6Wrong answer0/22ms2844 KiB
7Wrong answer0/22ms3112 KiB
8Wrong answer0/22ms2908 KiB
9Accepted2/22ms2936 KiB
10Accepted2/22ms2912 KiB
11Wrong answer0/23ms4260 KiB
12Wrong answer0/23ms4904 KiB
13Accepted3/37ms5168 KiB
14Accepted3/39ms7424 KiB
15Accepted3/38ms7372 KiB
16Accepted3/368ms26592 KiB
17Accepted3/370ms26596 KiB
18Accepted3/379ms26596 KiB
19Accepted3/313ms12684 KiB
20Accepted3/316ms15084 KiB
21Accepted3/386ms27008 KiB
22Accepted3/390ms26992 KiB