2 solutions

  • 0
    @ 2024-10-6 11:31:32

    #include<stdio.h> int main(){ int i,j,x,y,L,M,num[10001]; int cnt=0; scanf("%d %d",&L,&M); for(i=0;i<=L;i++){ num[i]=1; } for(i=1;i<=M;i++){ scanf("%d %d",&x,&y); for(j=x;j<=y;j++){ num[j]=0; } } for(i=0;i<=L;i++){ if(num[i]==1)cnt++; } printf("%d",cnt); return 0; }

    Information

    ID
    6771
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    6
    Tags
    (None)
    # Submissions
    206
    Accepted
    57
    Uploaded By