Problem Analysis
题目大意:飞机的飞行时间为 D D D分钟,中间提供 M M M次食物,每次的时间序列给定,每 T T T分钟入睡一次,要求求能否吃到食物。
思路分析:签到题,直接排序判断相邻间隔即可。注意给序列末尾加项 M M M。
#include
using namespace std;
const int N = 1e4 + 10;
int a[N];
inline int solve(){
int t, d, m; cin >> t >> d >> m;
for(int i = 1; i > a[i];
sort(a + 1, a + 1 + m);
a[m + 1] = d;
for(int i = 1; i = t) return cout
关注
打赏
热门博文
- 回坑记之或许是退役赛季?
- [LCT刷题] P1501 [国家集训队]Tree II
- [LCT刷题] P2147 洞穴勘测
- 2022-2023 ICPC Brazil Subregional Programming Contest VP记录
- [线段树套单调栈] 2019-2020 ICPC Asia Hong Kong Regional Contest H.[Hold the Line]
- The 2021 ICPC Asia Nanjing Regional Contest E.Paimon Segment Tree 区间合并线段树/维护矩阵乘法
- CF580E - Kefa and Watch 线段树维护哈希
- HDU5869 Different GCD Subarray Query 离线查询/区间贡献
- 27.CF1004F Sonya and Bitwise OR 区间合并线段树
- 26.CF1000F One Occurrence