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;
}