Cleaning Shifts Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4721   Accepted: 1593 Description Farmer John's cows, pampered since birth, have reached new heights of fastidiousness. They now require their barn to be immaculate. Farmer…
Cleaning Shifts Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2743   Accepted: 955 Description Farmer John's cows, pampered since birth, have reached new heights of fastidiousness. They now require their barn to be immaculate. Farmer J…
http://poj.org/problem?id=2376 题目大意: 给你一些区间的起点和终点,让你用最小的区间覆盖一个大的区间. 思路: 贪心,按区间的起点找满足条件的并且终点尽量大的. 一开始排序还考虑了起点一样终点要大的,想了想没必要,因为只后都是直接扫描满足条件的.. 注意的是比如[4.5]下一次可以直接[6,10]这样...这一步坑了我好久... 后来一直WA,改了老半天...发现是大于等于少写了个等号,,,我去面壁...我要蹲墙角... #include<cstdio> #in…
点我看题目 题意 :N个村子连成一条线,相邻的村子都有直接的地道进行相连,不相连的都由地道间接相连,三个命令,D x,表示x村庄被摧毁,R  ,表示最后被摧毁的村庄已经重建了,Q x表示,与x直接或间接相连的村庄有多少个,当然包括他自己. 思路 :这是一道用线段树,树状数组,还有STL都可以做的题....因为用线段树的更新什么的太麻烦,.....所以我用了树状数组 #include <iostream> #include <stdio.h> #include <string.…
[题目链接] http://poj.org/problem?id=3171 [题目大意] 给出一些区间和他们的价值,求覆盖一整条线段的最小代价 [题解] 我们发现对区间右端点排序后有dp[r]=min(dp[l-1~r-1])+s 而对于求最小值我们可以用线段树优化 [代码] #include <cstdio> #include <algorithm> #include <cstring> #include <climits> using namespace…
Description Farmer John's cows, pampered since birth, have reached new heights of fastidiousness. They now require their barn to be immaculate. Farmer John, the most obliging of farmers, has no choice but hire some of the cows to clean the barn. Farm…
题目:http://poj.org/problem?id=3171 题意:给你n个区间[a,b],每个区间都有一个费用c,要你用最小的费用覆盖区间[M,E] 分析:经典的区间覆盖问题,百度可以搜到这个专题. 线段覆盖问题一般考虑贪心和DP,但是每个区间又有了一个费用c,本渣觉得贪心貌似不太行(不知道神犇门有木有贪心解法),然后便考虑DP 设f[i]表示覆盖[M,i]的最小总费用 那么有f[t[i].a]=min(f[j]+t[i].c) t[i].a-1<=j<=t[i].b-1 那么ans=…
Cleaning Shifts Farmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleaning chores around the barn. He always wants to have one cow working on cleaning things up and has divided the day into T shifts (1 <= T <= 1,000,000…
Cleaning Shifts Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4422   Accepted: 1482 Description Farmer John's cows, pampered since birth, have reached new heights of fastidiousness. They now require their barn to be immaculate. Farmer…
Tunnel Warfare                                  Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Problem Description During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast…