显示代码纯文本
#include<cstdio>
#include<cctype>
#include<vector>
using namespace std;
const int maxn=300001;
const int maxm=100001;
int n,m,a[maxn];
struct lr{
int l,r,d;
}b[maxm];
vector<int> v;
bool flag;
inline void in(int &x){
x=0;int f=1;char c=getchar();
while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c)){x=x*10+c-48;c=getchar();}
x*=f;
}
inline void out(int x){//负数不可
char c[10]={0};
while(c[++c[0]]=x%10+'0',x/=10,x);
while(putchar(c[c[0]]),--c[0],c[0]);
}
inline int mian(){
freopen("HWsweepclassroom.in","r",stdin);
freopen("HWsweepclassroom.out","w",stdout);
//freopen("algorithm.in","r",stdin);
//freopen("algorithm.out","w",stdout);
in(n);in(m);
for(int i=1;i<=m;i++){
in(b[i].l);in(b[i].r);b[i].d=i;
for(int j=b[i].l;j<=b[i].r;j++) a[j]++;
}
for(int i=1;i<=m;i++){
flag=1;
for(int j=b[i].l;j<=b[i].r;j++){
a[j]--;
if(!a[j]){
flag=0;
break;
}
}
for(int j=b[i].l;j<=b[i].r;j++){
a[j]++;
}
if(flag) v.push_back(b[i].d);
}
out(v.size());putchar('\n');
for(int i=0;i<v.size();i++) out(v[i]),putchar(' ');
return 0;
}
int shimakaze=mian();
int main(){;}