1 solutions

  • 0
    @ 2026-8-4 11:52:18
    #include <bits/stdc++.h>
    using namespace std;
    int main(){
        int l, m, a[10001] = {0};
        int r, le;
        cin >> l >> m;
        for(int i = 1; i <= m; i++){
            cin >> r >> le;
            for(int j = r; j <= le; j++){
                a[j] = 1;
            }
        }
        int cnt = 0;
        for(int i = 0; i <= l; i++){
            if(a[i] == 0)
                cnt++;
        }
        cout << cnt << endl;
        return 0;
    }
    
    • 1

    Information

    ID
    1586
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    9
    Tags
    # Submissions
    11
    Accepted
    5
    Uploaded By