注意不能每个T都mem 不然会T

#include <bits/stdc++.h>
#define PI acos(-1.0)
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define pb push_back
#define inf 1e9
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que;
const double EPS = 1.0e-8;
const double eps = 1.0e-8;
typedef pair<int, int> pairint;
typedef long long ll;
typedef unsigned long long ull;
const int maxn = ;
const int maxm = ;
//next_permutation
int t;
int n;
int num[];
bitset<> f[];
int dp[][][];
int ques[];
bool ok(int a, int b, int c, int x)
{
if (x == a || x == b || x == c)
{
return true;
}
return false;
}
void getans()
{
for (int i = ; i <= n; i++)
for (int j = i; j <= n; j++)
for (int k = j; k <= n; k++)
{
for (int l = ; l <= ; l++)
{
f[l].reset();
}
f[][] = ;
for (int l = ; l <= n; l++)
{
for (int p = ; p >= ; p--)
{
if (ok(i, j, k, l) || num[l] > )
{
continue;
}
f[p] |= f[p - ] << num[l];
}
}
if (f[][])
{
dp[i][j][k] = ;
}
else
{
dp[i][j][k] = ;
}
}
}
int main()
{
cin >> t;
while (t--)
{
//mem(dp, 0);
scanf("%d", &n);
for (int i = ; i <= n; i++)
{
scanf("%d", &num[i]);
}
getans();
int m;
int a, b, c;
scanf("%d", &m);
for (int i = ; i <= m; i++)
{
scanf("%d%d%d", &ques[], &ques[], &ques[]);
sort(ques + , ques + );
if (dp[ques[]][ques[]][ques[]])
{
printf("Yes\n");
}
else
{
printf("No\n");
}
}
}
}

最新文章

  1. TSQL 分组集(Grouping Sets)
  2. HttpClientUtil简介
  3. 微信官方demo(php)
  4. css 多行溢出
  5. 在VS2103环境中集成Doxygen工具
  6. bat里如何用相对路径
  7. wireshark抓包图解 TCP三次握手/四次挥手详解
  8. 快速生成json实体类
  9. mysql 刘道成视频教程 第3课
  10. Android Intent传递对象小结
  11. Springboot中使用Scheduled做定时任务
  12. javascript:针对yyyy-MM-dd hh:mm:ss格式的毫秒转换.
  13. appium遇到click事件,提示&quot;w3cStatus&quot;:400
  14. Matlab feval函数(转)
  15. python 使用yield进行数据的流式处理
  16. Documentation/filesystems/sysfs.txt 文档翻译--sysfs
  17. Kali-linux破解LM Hashes密码
  18. 【筛法求素数】【推导】【组合数】UVALive - 7642 - Prime Distance
  19. Java程序员从笨鸟到菜鸟之(九十六)深入java虚拟机(五)——java本地接口JNI详解
  20. @RestControllerAdvice注解使用

热门文章

  1. 分享页(把末尾的JS函数换成这个)
  2. xml文件中 xmlns xmlns:xsi 等解释
  3. Mac securecrt 破解版安装
  4. js2flowchart
  5. Ansible安装及常用模块
  6. Jmeter之简单控制器
  7. linux打包
  8. Linux中MySQL5.7设置utf8编码格式步骤
  9. 【Linux开发】【Qt开发】Qt界面键盘、触摸屏、鼠标的响应设置
  10. python+selenium控制浏览器窗口(刷新、前进、后退、退出浏览器)