链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1961

训练指南page228

 1 #include <cstdio>
 2 #include <set>
 3 using namespace std;
 4 struct Point
 5 {
 6     int a, b;
 7     bool operator < (const Point & other) const
 8     {
 9         return (a < other.a) || (a == other.a && b < other.b);
10     }
11 };
12 multiset<Point> S;
13 multiset<Point>::iterator it;
14 int main(void)
15 {
16     #ifndef ONLINE_JUDGE
17      freopen("11020.in", "r", stdin);
18     #endif // ONLINE_JUDGE
19     int T; scanf("%d", &T);
20     for (int i = 1; i <= T; ++i)
21     {
22         printf("Case #%d:\n", i); int n, a, b; scanf("%d", &n); S.clear();
23         while (n--)
24         {
25             scanf("%d%d", &a, &b); Point P = (Point){a, b}; it = S.lower_bound(P);
26             if (it == S.begin() || (--it)->b > b) S.insert(P), it = S.upper_bound(P);
27             while (it != S.end() && it->b >= b) S.erase(it++);
28             printf("%d\n", S.size());
29         }
30         if (i!=T) printf("\n");
31     }
32     return 0;
33 }

。。

  本来想睡觉的,这题看了一半,还是做完吧,贴完睡觉。

  今天身体超级难受……好久没生过病了,没想到这么痛苦,o(╯□╰)o头疼,浑身上下都不舒服,下午去机房,那个难受啊,我去……赶紧回来了,晚上在综合楼还好一点,以后就住在综合楼和KFC和书院九号了。头晕,睡觉……

  对了,明天晚上跑步去,不去锻炼一下一点儿也没意思……什么毛病都出来了。。=_=

  晚安。

相关文章:

  • 2022-01-17
  • 2021-07-09
  • 2022-03-03
  • 2022-12-23
  • 2021-10-06
  • 2021-07-11
  • 2021-08-08
  • 2021-10-22
猜你喜欢
  • 2022-02-16
  • 2021-09-13
  • 2021-05-15
  • 2021-10-06
  • 2021-07-04
  • 2022-01-11
相关资源
相似解决方案