#include<bits/stdc++.h>
using namespace std;
struct node{
}q[11];
int t,n;
bool book[11];//标记第i架飞机是否降落
bool dfs(int num,int last)
{
}
int main()
{
std::ios::sync_with_stdio(false),cout.tie(0),cin.tie(0);
}
using namespace std;
struct node{
int a,b,c;}q[11];
int t,n;
bool book[11];//标记第i架飞机是否降落
bool dfs(int num,int last)
{
if(num==n)return 1;
for(int i=1;i<=n;i++)
{
if(!book[i]&&q[i].a+q[i].b>=last)
{
book[i]=1;
if(dfs(num+1,max(last,q[i].a)+q[i].c))
return 1;
book[i]=0;
}
}
return 0;}
int main()
{
std::ios::sync_with_stdio(false),cout.tie(0),cin.tie(0);
cin>>t;
while(t--)
{
memset(book,0,sizeof(book));
cin>>n;
for(int i=1;i<=n;i++){
int a,b,c;
cin>>a>>b>>c;
q[i].a=a;q[i].b=b;q[i].c=c;
}
if(dfs(0,0))
cout<<"YES\\n";
else
cout<<"NO\\n";
}
return 0;}
0 回复
0 转发
0 喜欢
1 阅读



