题目:https://codeforces.com/problemset/problem/1552/D
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
ll a[11];
map<int, int>mp;
ll n;
void dfs(ll tag, ll cnt)
{
if (tag > n)
{
mp[cnt]++;
return;
}
dfs(tag + 1, cnt);//选或者不选 列出两种情况
dfs(tag + 1, cnt + a[tag]);
}
int main()
{
ll T;
cin >> T;
while (T--)
{
cin >> n;
memset(a, 0, sizeof(a));
mp.clear();
for (int i = 1; i <= n; i++) { cin >> a[i]; }
dfs(1, 0);
bool first = true;
for (auto x : mp)
{
if (x.second > 1)
{
first = false;
}
}
if (first)
{
puts("NO\n");
}
else
{
puts("YES\n");
}
}
}