14 条题解

  • 0
    @ 2025-9-19 19:52:40

    #include<bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int a[N]; int main() { int n,m; cin>>n>>m; for(int i = 0,l,r ; i < m ;i++) { cin >> l >> r; for(int j = l ; j <= r ; j++) { a[j] = 1; } } int ans = 0; for(int i = 0 ; i <= n ; i++ ) { if(a[i] == 0) ans++; } cout << ans << endl; return 0; }

    信息

    ID
    677
    时间
    1000ms
    内存
    256MiB
    难度
    6
    标签
    递交数
    1136
    已通过
    319
    上传者