一、视频讲解
视频讲解

二、暴力代码(也是正解代码)
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 10 + 20;
struct plane{
int t, d, l;
}p[N];
bool st[N];
int n;
bool dfs(int u, int time)
{
if(u >= n)
return true;
for(int i = 0; i < n; i ++)
{
if(!st[i])
{
st[i] = true;
if(p[i].t + p[i].d < time)
{
st[i] = false;
return false;
}
int t = max(time, p[i].t) + p[i].l;
if(dfs(u + 1, t))
return true;
st[i] = false;
}
}
return false;
}
void solve()
{
cin >> n;
for(int i = 0; i < n; i ++)
cin >> p[i].t >> p[i].d >> p[i].l;
if(dfs(0, 0))
cout << "YES" << endl;
else
cout << "NO" << endl;
for(int i = 0; i < n; i ++)
st[i] = false;
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t = 1;
cin >> t;
while(t--)
solve();
}