老师特别执着地让我做USASO那好吧。。我尽快把它做完! 虽然大家都说做这个蛮无聊的, 但我的代码能力有提升的必要, 现在的代码能力太烂啦!
Chapter 1
1.2
1.2.1: 这道题的解法还是很多的! 我为了练习先打了一个线段树, 但是这道题还必须离散一下要不然会爆空间。。最后写出来巨丑就不发了。 然后又写了一个简单的排序之后扫一遍的方法。
/*
ID: ayaya1
LANG: C++
TASK: milk2
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
int n, ans1, ans2;
struct point{
int l, r;
}a[5005];
bool cmp(point x, point y){
return x.l < y.l;
}
int main()
{
freopen("milk2.in", "r", stdin);
freopen("milk2.out", "w", stdout);
scanf("%d", &n);
for(int i = 1; i <= n; i ++)scanf("%d%d", &a[i].l, &a[i].r);
sort(a + 1, a + n + 1, cmp);
for(int i = 1; i <= n;){
int j = i + 1, ts = a[i].l, te