当前位置:网站首页>牛客 - 最佳直播时间 (差分)
牛客 - 最佳直播时间 (差分)
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;
}
边栏推荐
- ArcEngine(一)加载矢量数据
- 行业洞察 | 如何更好的实现与虚拟人的互动体验?
- How does Mysql query two data tables for the same fields in two tables at the same time
- 智能客服,还有多少AI泡沫?
- RViz报错: Error subscribing: Unable to load plugin for transport ‘compressed‘解决方法
- 实时目标检测新高地之#YOLOv7#更快更强的目标检测器
- The use of the database table structure document generation tool screw
- “碳中和”愿景下,什么样的数据中心才是我们需要的?
- 001-进程与线程
- pyspark---encode the suuid interval (based on the number of exposures and clicks)
猜你喜欢
随机推荐
ArcEngine (4) Use of MapControl_OnMouseDown
002-字段不为null
ArcEngine(八)用IWorkspaceFactory加载矢量数据
Mysql的in和exists用法区别
[Hello World] 二分查找笔记
Postman will return to results generated CSV file to the local interface
Roson的Qt之旅#103 QML之标签导航控件TabBar
Pop Harmony Basics Big Notes
ArcEngine(四)MapControl_OnMouseDown的使用
mysql系统变量与状态变量
timestamp
[Kaggle combat] Prediction of the number of survivors of the Titanic (from zero to submission to Kaggle to model saving and restoration)
How does Mysql query two data tables for the same fields in two tables at the same time
并发之多把锁和活跃性
五、《图解HTTP》报文首部和HTTP缓存
redis键值出现 xacxedx00x05tx00&的解决方法
Charles packet capture tool learning record
[ 漏洞复现篇 ] yapi 代码执行 getshell 漏洞复现详解
Mysql如何对两张表的相同字段,同时查询两张数据表
ArcEngine(六)用tool工具实现拉框放大缩小和平移









