67492023-12-18 18:07:09szasztundeÁruszállítás üres szakaszaicpp17Wrong answer 0/50370ms12248 KiB
#include <iostream>

using namespace std;
int x[1000001]={0};
int main()
{
    int n,m,a,b;
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        cin>>a>>b;
        for(int k=a;k<=b;k++) x[k]++;
    }
    int db=0;
    for(int i=1;i<=n;i++)
        {
            cout<<x[i]<<" ";
            if(x[i]==0)
            {
                int db0=1,j=i+1;
                while(j<=n && x[j]==0) { db0++; j++; }
                i=j;
                db=db+db0;
                if(j<n) db++;
            }
        }
    cout<<db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/03ms1880 KiB
2Wrong answer0/0199ms9880 KiB
3Wrong answer0/23ms2220 KiB
4Wrong answer0/23ms2484 KiB
5Wrong answer0/23ms2632 KiB
6Wrong answer0/23ms2860 KiB
7Wrong answer0/23ms3052 KiB
8Wrong answer0/23ms3260 KiB
9Wrong answer0/23ms3356 KiB
10Wrong answer0/23ms3340 KiB
11Wrong answer0/23ms3740 KiB
12Wrong answer0/24ms4072 KiB
13Wrong answer0/314ms4332 KiB
14Wrong answer0/319ms5080 KiB
15Wrong answer0/316ms5108 KiB
16Time limit exceeded0/3370ms3480 KiB
17Time limit exceeded0/3358ms3640 KiB
18Time limit exceeded0/3361ms3816 KiB
19Wrong answer0/348ms7344 KiB
20Wrong answer0/354ms8052 KiB
21Wrong answer0/3186ms12248 KiB
22Wrong answer0/3189ms12200 KiB