当前位置:网站首页>牛客 - 最佳直播时间 (差分)
牛客 - 最佳直播时间 (差分)
2022-08-03 07:59:00 【GHOSTANDBREAD】
题目链接:https://ac.nowcoder.com/acm/contest/38305/E
思路:
读入一段时间,这个时间段的数值都加1,最后数值最大的就是数就是答案
代码:
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
const int N = 86400 + 10;
int s[N];
int main() {
int n;
scanf("%d", &n);
while(n --) {
int a, b, c, d, e, f;
scanf("%d:%d:%d - %d:%d:%d", &a, &b, &c, &d, &e, &f);
s[(a * 60 + b) * 60 + c] ++;
s[(d * 60 + e) * 60 + f + 1] --;
}
int maxn = -1;
for(int i = 1; i <= 86410; i ++) {
s[i] += s[i - 1];
maxn = max(maxn, s[i]);
}
printf("%d", maxn);
return 0;
}
边栏推荐
猜你喜欢

面渣逆袭:MySQL六十六问,两万字+五十图详解

【Kaggle实战】泰坦尼克号生存人数预测(从零到提交到Kaggle再到模型的保存与恢复)

Shell运维开发基础(一)

pyspark---encode the suuid interval (based on the number of exposures and clicks)

The Transformer, BERT, GPT paper intensive reading notes

Nacos使用实践

MySQL数据库————数据库与vs的连接

Poke the myth of Web3?Poke the iron plate.

如何使用电子邮件营销在五个步骤中增加产品评论

【云原生--Kubernetes】Pod容器与镜像拉取策略
随机推荐
@Async注解的坑,小心
mysql存生僻字奇怪问题,mysql为什么不能辨别mb4字符?
requests库
五、《图解HTTP》报文首部和HTTP缓存
实时目标检测新高地之#YOLOv7#更快更强的目标检测器
mysql5.7服务器The innodb_system data file 'ibdata1' must be writable导致无法启动服务器
rust 学习笔记
[Kaggle combat] Prediction of the number of survivors of the Titanic (from zero to submission to Kaggle to model saving and restoration)
解决GANs训练中模式崩塌/训练崩溃的十五个方法
FusionAccess软件架构、FusionAccess必须配置的四个组件、桌面发放流程、虚拟机组类型、桌面组类型
ArcEngine(一)加载矢量数据
“==”和equals的区别
0day_Topsec上网行为管理RCE
mysqlbinlog: unknown variable 'default-character-set=utf8'
mysql服务器上的mysql这个实例中表的介绍
Karatsuba大数乘法的Verilog实现
工控机防勒索病毒浅析
Roson的Qt之旅#104 QML Image控件
swiper分类菜单双层效果demo(整理)
ArcEngine (2) loading the map document