感觉自己有点强迫症 不都写出来就找理由不写题解
http://codeforces.com/contest/1015 题目链接
A. Points in Segments
题目意思 n个线段 去覆盖1-m 中的点 问你没有覆盖的点的个数和位置
这个数据很小,可以直接暴力查找
思考:如果n<1e6, m<=1e8 呢?
#include<bits/stdc++.h> #define int long long #define MAX(a,b,c) max(a,max(b,c)) #define MIN(a,b,c) min(a,min(b,c)) #define pb push_back #define fi first #define se second typedef long long ll; typedef long long LL; typedef unsigned long long ull; typedef unsigned long long uLL; using namespace std; const int maxn=1e5+10; const int INF=0x3f3f3f3f; map<int,int> mp; int32_t main() { int n,m; cin>>n>>m; for(int i=1;i<=n;i++) { int a,b; cin>>a>>b; for(int j=a;j<=b;j++) mp[j]=1; } int t=0; for(int i=1;i<=m;i++) { if(mp[i]==0) { t++; } }cout<<t<<endl; for(int i=1;i<=m;i++) { if(mp[i]==0) { cout<<i<<" "; } } }