首先呢,每个数选与不选,总共有2^n-1种选数方案(因为除去所有不选),题目中给出一个要求,所有数的和%200相同,这个有什么用呢?我们总共2的n-1种选数方案,理论上说我们会有2的n次方-1种结果,那%200,就相当于把这么多结果放到200个盒子里,那我们就可以想到鸽巢原理。所以我们可以直接爆搜,反正最多两百种情况。
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<sstream>
#include<queue>
#include<list>
#include<bitset>
#include<stack>
#include<bitset>
#include<iomanip>
#include<set>
#include<cmath>
#include<map>
#include<functional>
#define int long long
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define _BYTE unsigned char
#define HIBYTE(x) (*((_BYTE*)&(x)+1))
#define eps 1e-8
//#define double long double
using namespace std;
int n,a[205];
vector<int>val[203],temp,ans1,ans2;
bool flag;
void dfs(int pos,int sum)
{
if(flag)return;
if(pos==n+1)
{
//if(sum==0)return;
if(temp.size()&&val[sum].size())
{
flag=true;
ans1=val[sum];
ans2=temp;
return;
}
else
{
val[sum]=temp;
return;
}
}
dfs(pos+1,sum);
temp.push_back(pos);
dfs(pos+1,(sum+a[pos])%200);
temp.pop_back();
}
signed main()
{
IO;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
dfs(1,0);
if(flag)
{
cout<<"Yes"<<endl;
cout<<ans1.size()<<" ";
for(auto it=ans1.begin();it!=ans1.end();it++)
{
cout<<*it<<" ";
}
cout<<endl;
cout<<ans2.size()<<" ";
for(auto it=ans2.begin();it!=ans2.end();it++)
{
cout<<*it<<" ";
}
cout<<endl;
}
else
{
cout<<"No";
}
}