大意:
找两个不同的序列使得他们在mod 200的意义下相等
2
8
=
256
>
200
2^{8} =256 > 200
28=256>200,所以8个数构成的子序列必定有相同的子序列,状态压缩枚举min(8,n)的状态,如果第二次碰到某个数则输出yes,并输出序列
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n,cnt;
signed main(){
ios;
cin>>n;
vector<int>a(n);
for(int i = 0;i<n;++i){
cin>>a[i];
a[i]%=200;
}
vector<int> vis[201];
cnt = min(n,8);
for(int i = 1;i<(1<<cnt);++i){
int sum = 0;
vector<int> tmp;
for(int j = 0;j<cnt;++j){
if(i&(1<<j)){
tmp.push_back(j+1);
sum = (sum+a[j])%200;
}
}
//cout<<sum<<"\n";
if((int)vis[sum].size()!=0){
cout<<"Yes\n";
cout<<vis[sum].size()<<" ";
for(auto i:vis[sum]) cout<<i<<' ';
cout<<"\n"<<tmp.size()<<" ";
for(auto i:tmp) cout<<i<<" ";
cout<<"\n";
return 0;
}else vis[sum] = tmp;
}
cout<<"No\n";
return 0;
}