传送门 P9241 [蓝桥杯 2023 省 B] 飞机降落 - 洛谷
n<=10,考虑dfs,只有当 当前飞机的到达时刻+盘旋时间 <= 上一个飞机降落的时刻 时,当前飞机才能降落
cpp
const int N = 1e3 + 10;
int n;
struct Node
{
LL t,d,l;
}a[N];
bool st[N];
bool dfs(int u,LL last)
{
if (u > n) return true;
for (int i = 1;i <= n;i ++)
{
if (!st[i] && a[i].t + a[i].d >= last)
{
st[i] = true;
if (dfs(u + 1,max(a[i].t,last) + a[i].l)) return true;
st[i] = false;
}
}
return false;
}
void solve()
{
cin >> n;
memset(st,0,sizeof st);
for (int i = 1;i <= n;i ++)
{
int t,d,l;cin >> t >> d >> l;
a[i] = {t,d,l};
}
if (dfs(1,0)) cout << "YES" << endl;
else cout << "NO" << endl;
}