const int MAXN = 110000; struct Node { int num, isr, id, time; bool operator< (const Node& rhs) const { if (time != rhs.time) return time < rhs.time; return isr > rhs.isr; } } ipt[MAXN]; int main() { int T, a, b, c, d, n, num; RI(T); FE(kase, 1, T) { RI(n); REP(i, n) { scanf("%d %d:%d %d:%d", &num, &a, &b, &c, &d); int x = i << 1, y = x | 1; ipt[x].isr = 0; ipt[x].time = a * 60 + b; ipt[y].isr = 1; ipt[y].time = c * 60 + d; ipt[x].id = ipt[y].id = i; ipt[x].num = ipt[y].num = num; } n <<= 1; sort(ipt, ipt + n); set<int> st; int ans = 0, tans = 0; REP(i, n) { if (ipt[i].isr) { st.erase(ipt[i].id); tans -= ipt[i].num; } else { st.insert(ipt[i].id); tans += ipt[i].num; } ans = max(ans, tans); } WI(ans); } return 0; }
TIANKENG’s restaurant,布布扣,bubuko.com
原文地址:http://blog.csdn.net/wty__/article/details/38301837