http://codeforces.com/contest/1015/problem/A
题意:n个区间,m表示1-m个数
给你n个区间,删除l-r之间的数,最后输出没有被删掉的个数及所有的数
思路:暴力去删,特判0
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
#define ll long long
const int maxn = 1e5+50;
int n, m;
int a[maxn];
int main()
{
scanf("%d%d", &n, &m);
int l, r;
for (int i = 0; i <= m; i ++) {
a[i] = i;
}
for (int i = 0; i < n; i ++) {
scanf("%d%d", &l, &r);
for (int i = l; i <= r; i ++) {
a[i] = 0;
}
}
int ans = 0;
for (int i = 1; i <= m; i ++) {
if (a[i]) ans ++;
}
if (ans == 0) printf("0\n");
else {
printf("%d\n", ans);
for (int i = 0; i <= m; i ++) {
if (a[i]) printf("%d ", a[i]);
}
printf("\n");
}
}