Update

One new tab added. Open in browser view if it is not visible. (08/08/2025 12:56)

Not In Range

Language : C++
(NOTE : Try a few times yourself before moving to the solution)


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){

    int n;
    cin>>n;
    int a[1000001]={0}, l, r;
    for(int i=0;i>l>>r;
        a[l]++;
        a[r+1]--;
    }
    for(int i=1;i<1000001;i++)
        a[i] += a[i-1];

    ll res = 0;
    for(int i=1;i<1000001;i++)
        if(a[i] == 0)
            res += i;
    cout<

No comments: