36522023-03-01 18:37:46nkdorka1212Áruszállítás üres szakaszaicpp17Wrong answer 0/50192ms11880 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    vector<int>v(n+1,0);
    for(int i=1;i<=m;i++)
    {
        int a,b;
        cin>>a>>b;
        v[a]++;
        v[b]--;
    }
    for(int i=1;i<=n;i++)
    {
        v[i]+=v[i-1];
    }
    int cnt=0;
    v[0]=1;
    for(int i=1;i<=n-1;i++)
    {
        if(v[i-1]!=0 && v[i]==0)
        {
            cnt++;
        }
    }
    for(int x:v)
    {
        cout<<x<<" ";
    }
    cout<<endl;
    cout<<cnt<<"\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/03ms1816 KiB
2Wrong answer0/0190ms9816 KiB
3Wrong answer0/23ms2336 KiB
4Wrong answer0/23ms2540 KiB
5Wrong answer0/23ms2688 KiB
6Wrong answer0/23ms2788 KiB
7Wrong answer0/23ms2908 KiB
8Wrong answer0/23ms2964 KiB
9Wrong answer0/23ms2936 KiB
10Wrong answer0/23ms3180 KiB
11Wrong answer0/29ms3592 KiB
12Wrong answer0/214ms4088 KiB
13Wrong answer0/317ms4196 KiB
14Wrong answer0/328ms5100 KiB
15Wrong answer0/327ms5140 KiB
16Wrong answer0/3180ms11628 KiB
17Wrong answer0/3186ms11688 KiB
18Wrong answer0/3192ms11676 KiB
19Wrong answer0/354ms6988 KiB
20Wrong answer0/367ms7780 KiB
21Wrong answer0/3185ms11804 KiB
22Wrong answer0/3187ms11880 KiB