CROC-MBTU 2012, Elimination Round / 245F Log Stream Analysis (日期处理&二分)
2014-03-09 10:55
435 查看
http://codeforces.com/problemset/problem/245/F
/*60ms,16600KB*/ #include<bits/stdc++.h> using namespace std; const int mx = 5000005; const int month[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; const int day2s = 24 * 3600; char str[mx]; int t[3000005], mm, mo, d, h, m, s, cnt; inline int cnt_s() { int ans = 0; for (int i = 1; i < mo; ++i) ans += month[i]; ans += d - 1; ans *= day2s; ans += h * 3600 + m * 60 + s; return ans; } inline bool judge(int now) { return t + cnt - lower_bound(t, t + cnt, now) >= mm; } int main() { int len; scanf("%d%d", &len, &mm); getchar(); bool ok = false; while (gets(str)) { sscanf(str, "%*d%*c%d%*c%d %d%*c%d%*c%d", &mo, &d, &h, &m, &s); t[cnt++] = cnt_s(); if (judge(t[cnt - 1] - len + 1)) { printf("2012-%02d-%02d %02d:%02d:%02d\n", mo, d, h, m, s); ok = true; break; } } if (!ok) puts("-1"); return 0; }
相关文章推荐
- CROC-MBTU 2012, Elimination Round / 245D Restoring Table (位运算)
- CROC-MBTU 2012, Elimination Round / 245E Mishap in Club (想法题)
- CROC 2016 - Elimination Round (Rated Unofficial Edition) C. Enduring Exodus 二分
- (CROC 2016 - Elimination Round (Rated Unofficial Edition))C. Enduring Exodus(二分)
- CF #CROC 2016 - Elimination Round D. Robot Rapping Results Report 二分+拓扑排序
- 【CROC 2016 - Elimination RoundD】【二分答案orSet】Robot Rapping Results Report 最早多条边出现可以完成唯一拓扑序
- CF CROC-MBTU 2012, Final Round div 2
- (CROC 2016 - Elimination Round (Rated Unofficial Edition))D. Robot Rapping Results Report(二分+拓扑排序)
- CROC 2016 - Elimination Round C 二分
- 【CROC 2016 - Elimination RoundC】【二分】Enduring Exodus 最小的人看守与羊距离
- CROC 2016 - Elimination Round (Rated Unofficial Edition) D. Robot Rapping Results Report 二分+拓扑排序
- CROC-MBTU 2012, Elimination Round (ACM-ICPC)
- CROC 2016 - Elimination Round (Rated Unofficial Edition) E. Intellectual Inquiry 贪心 构造 dp
- Educational Codeforces Round 3 D.Gadgets for dollars and pounds(贪心&&二分)
- (CROC 2016 - Elimination Round (Rated Unofficial Edition))A. Amity Assessment(贪心)
- MySQL入门(2)- 排序&数据处理函数&日期处理函数
- ABAP - 日期格式转换 & ABAP经常使用日期处理函数
- 时间处理:计算下一天日期,如输入&quot;2004/12/31&quot;(注释2014年12月31日),则输出&quot;2005/1/1&quot;.
- CF_Croc Champ 2012 - Round 2 (Unofficial Div. 2 Edition)
- CROC-MBTU 2012, Elimination Round (ACM-ICPC) E. Mishap in Club