139802025-01-09 13:49:22madvirÁruszállítás üres szakaszaicpp17Wrong answer 0/50190ms10032 KiB
#include <iostream>

using namespace std;

int main()
{
    int n, m, kezd=0, veg=0;
    cin >> n >> m;
    int a[n+1]={0};
    for(int i=0; i<m; i++) {
        cin >> kezd >> veg;
        a[kezd]++;
        a[veg]--;
    }
    for(int i=2; i<=n; i++) {
        a[i]=a[i]+a[i-1];
    }
    for(int i=1; i<=n; i++) {
        cout <<a[i] << " ";
    }
    int x=1, card=0;
    while(x<=n) {
        while(a[x]!=0 && x<=n) x++;
        if(x==n+1) break;
        else {
            if(x!=n) card++;
            while(a[x]==0 && x<=n) x++;
        }
    }
    cout << card;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/0190ms6708 KiB
3Wrong answer0/21ms500 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms388 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/21ms316 KiB
10Wrong answer0/21ms316 KiB
11Wrong answer0/28ms568 KiB
12Wrong answer0/213ms872 KiB
13Wrong answer0/314ms900 KiB
14Wrong answer0/327ms1332 KiB
15Wrong answer0/325ms1272 KiB
16Wrong answer0/3178ms9264 KiB
17Wrong answer0/3179ms9172 KiB
18Wrong answer0/3187ms10032 KiB
19Wrong answer0/350ms2612 KiB
20Wrong answer0/364ms3124 KiB
21Wrong answer0/3180ms6452 KiB
22Wrong answer0/3181ms6612 KiB