ZOJ 3787 Access System 水
LINK:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3787
思路:结构体 时间转化为秒记录下最小并且排序就好了
/** @Date : 2017-03-23-22.06
* @Author : Lweleth (SoungEarlf@gmail.com)
* @Link : https://github.com/
* @Version :
*/
#include<bits/stdc++.h>
#define LL long long
#define PII pair
#define MP(x, y) make_pair((x),(y))
#define fi first
#define se second
#define PB(x) push_back((x))
#define MMG(x) memset((x), -1,sizeof(x))
#define MMF(x) memset((x),0,sizeof(x))
#define MMI(x) memset((x), INF, sizeof(x))
using namespace std; const int INF = 0x3f3f3f3f;
const int N = 2e4+20;
const double eps = 1e-8; struct yuu
{
int t, m;
}a[N]; int cmp(yuu a, yuu b)
{
if(a.t != b.t)
return a.t < b.t;
return a.m < b.m;
} int b[N];
int main()
{
int T;
cin >> T;
while(T--)
{
int n, l;
int h, m, s;
cin >> n >> l;
int cnt = 0; int mi = -1;
for(int i = 0; i < n; i++)
{
scanf("%d:%d:%d", &h, &m, &s);
a[i].t = h * 3600 + m * 60 + s;
a[i].m = i + 1;
}
sort(a, a + n, cmp);
for(int i = 0; i < n; i++)
{
if(a[i].t >= mi)
b[cnt++] = a[i].m, mi = a[i].t + l;
}
printf("%d\n", cnt);
sort(b, b + cnt);
for(int i = 0; i < cnt; i++)
printf("%d%s", b[i], i==cnt - 1?"\n":" ");
}
return 0;
}
ZOJ 3787 Access System 水的更多相关文章
- zoj 3787 Access System
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5274 #include <cstdio> #include < ...
- C++版 - 剑指Offer 面试题45:圆圈中最后剩下的数字(约瑟夫环问题,ZOJ 1088:System Overload类似)题解
剑指Offer 面试题45:圆圈中最后剩下的数字(约瑟夫环问题) 原书题目:0, 1, - , n-1 这n个数字排成一个圈圈,从数字0开始每次从圆圏里删除第m个数字.求出这个圈圈里剩下的最后一个数字 ...
- ZOJ 2723 Semi-Prime ||ZOJ 2060 Fibonacci Again 水水水!
两题水题: 1.如果一个数能被分解为两个素数的乘积,则称为Semi-Prime,给你一个数,让你判断是不是Semi-Prime数. 2.定义F(0) = 7, F(1) = 11, F(n) = F( ...
- ZOJ 3827 Information Entropy 水
水 Information Entropy Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Informati ...
- ZOJ Course Selection System DP
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5565 Course Selection System Time ...
- ZOJ 3819 Average Score 水
水 Average Score Time Limit: 2 Seconds Memory Limit: 65536 KB Bob is a freshman in Marjar Univer ...
- ZOJ Special AC String 水
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3702 题目大意: 对于给定的一个字符串,满足如下要求输出AC,否则WA(好吧我 ...
- ZOJ 3168 Sort ZOJ7 水
再水一发,舍友肿么还在睡T T. ---------------------------------舍友还在睡觉的分割线--------------------------------- http:/ ...
- ZOJ 2514 Generate Passwords 水
啦啦啦,水一发准备去复习功课~ ------------------------------------------水一发的分割线----------------------------------- ...
随机推荐
- 用VS测试程序
怀着一种忐忑的心情,我开始了我的软件测试. #include "stdio.h" #include "stdlib.h" int main(int argc, ...
- python __call__ 函数
__call__ Python中有一个有趣的语法,只要定义类型的时候,实现__call__函数,这个类型就成为可调用的. 换句话说,我们可以把这个类型的对象当作函数来使用,相当于 重载了括号运算符. ...
- Codeforces Beta Round #14 (Div. 2) D. Two Paths 树的直径
题目链接: http://codeforces.com/contest/14/problem/D D. Two Paths time limit per test2 secondsmemory lim ...
- HttpCookie Class
提供创建和操作各 HTTP Cookie 的类型安全方法. #region 写入指定Cookie的值 +static void WriteCookie(string cookieName, strin ...
- TCP系列41—拥塞控制—4、Linux中的慢启动和拥塞避免(一)
一.Linux中的慢启动和拥塞避免 Linux中采用了Google论文的建议把IW初始化成了10了.在linux中一般有三种场景会触发慢启动过程 1.连接初始建立发送数据的时候,此时cwnd初始化为1 ...
- 删除多余的自编译的内核、mysql连接不了的问题
1.删除多余的自编译的内核 每次Debian发布内核更新,总是有某些内核选项跟自己的硬件不配套,要自己编译内核.编译多了,多余的内核就占用了多余的硬盘空间.我就试过因为/boot分区满了,而导致编译内 ...
- VMware12 pro装unlocker207补丁后依然没有apple mac选项,问题解决
把VMware所有的服务先停止,任务管理器里面的也停止.然后再安装unlocker207补丁就行了.亲测.
- 转 下一代云计算模式:Docker正掀起个性化商业革命
下一代云计算模式:Docker正掀起个性化商业革命 作者: 吴宁川 来源: ITValue 发布时间: 2015-09-20 10:41 阅读: 14052 次 推荐: 26 原文链接 ...
- gulp 定义依赖关系
var gulp = require('gulp'); // 返回一个 callback,因此系统可以知道它什么时候完成 gulp.task('one', function(cb) { // 做一些事 ...
- Mysql 学习之 SQL的执行顺序
mysql的json查询: 1.一条普通的SQL SELEC ...