SRM522 div1 03
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#define ll long long
#define For(ir,S) for(typeof(S.begin()) ir = S.begin(); ir!=S.end(); ir++)
using namespace std;
const int _=60;
class PointErasing
{
public:
int ok(int a,int b,int c)
{
return a<b and b<c or a>b and b>c;
}
int ok(int x1,int y1,int x2,int y2,int x3,int y3)
{
return ok(x1,x2,x3) and ok(y1,y2,y3);
}
int n;
int can[_],must[_],ins[_][_][_];
int vis[_];
set<ll>S;
map<ll,int>M;
vector<int> getOutcomes(vector<int> y)
{
memset(ins,0,sizeof ins);
memset(can,0,sizeof can);
memset(must,0,sizeof must);
n=y.size();
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
for(int k=0;k<n;k++)
{
ins[i][j][k]=ok(j,y[j],i,y[i],k,y[k]);
if(ins[i][j][k])
can[i] = 1;
}
}
}
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
for(int k=0;k<n;k++)
if(!can[j] and !can[k] and ins[i][j][k])
must[i]=1;
S.clear();
/// j,k包含哪些点
for(int j=0;j<n;j++)
{
for(int k=0;k<n;k++)
{
ll t=0;
for(int i=0;i<n;i++)
{
if(!must[i] and ins[i][j][k])
t|=1LL<<i;
S.insert(t);
}
}
}
M.clear();
M[1]=0;
For(it,S)
{
For(ir,M)
{
ll t = *it;
if(ir->first==0 or (t & ir->first) != ir->first)
{
M.insert(make_pair(t,ir->second+__builtin_popcountll(t & (~ir->first))));
}
}
}
memset(vis,0,sizeof vis);
For(it,M)
vis[it->second]=1;
vector<int>res;
int cnt=0;
for(int i=0;i<n;i++)
cnt+=must[i];
n-=cnt;
for(int i=50;i>=0;i++)
{
if(vis[i])
res.push_back(n-i));
}
return res;
}
};
int main()
{
}