Description
“Fat and docile, big and dumb, they look so stupid, they aren’t much
fun…”
- Cows with Guns by Dana LyonsThe cows want to prove to the public that they are both smart and fun. In order t...
分类:
其他好文 时间:
2015-04-21 22:51:44
阅读次数:
185
Sightseeing CowsTime Limit:1000MSMemory Limit:65536KTotal Submissions:8197Accepted:2750DescriptionFarmer John has decided to reward his cows for their...
分类:
其他好文 时间:
2015-04-19 21:09:15
阅读次数:
184
HotelTime Limit: 3000MS Memory Limit: 65536K
Total Submissions: 13034 Accepted: 5606 DescriptionThe cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacati...
分类:
其他好文 时间:
2015-04-18 14:35:37
阅读次数:
157
题意:有n个牛,m个有向“仰慕”关系,关系可传递,求多少个牛被所有牛都“仰慕”
思路:显然被所有牛仰慕的牛群是一强连通分量
所以先把乱图缩点成有向无环图
对有向无环图有这个重要结论:
任何连通的图都至少有一个入度为0的点和至少有一个出度为0的点(也就是至少有一个最高强连通分量和一个最低强连通分量)
所以本题是找连通图的唯一的最低强连通分量,显然仅有一个出度为0的强连通分量...
分类:
其他好文 时间:
2015-04-17 22:27:01
阅读次数:
201
题意:
有向图中每个点有一个欢乐值,边有边权,要求一条环路,使环路上欢乐值得和/路径和最大。
分析:
二分参数,判断是否存在负权,这里判负圈没用spfa,用的是一种效率很高的方法。
代码:
//poj 3621
//sep9
#include
#include
using namespace std;
const int maxN=1024;
const int maxM=5012;...
分类:
其他好文 时间:
2015-04-17 11:35:23
阅读次数:
196
Cow SortingTime Limit:2000MSMemory Limit:65536KTotal Submissions:6287Accepted:2429DescriptionFarmer John'sN(1 ≤N≤ 10,000) cows are lined up to be milk...
分类:
其他好文 时间:
2015-04-16 01:06:13
阅读次数:
168
The Cow LineupTime Limit:1000MSMemory Limit:30000KTotal Submissions:5342Accepted:3184DescriptionFarmer John's N cows (1 #include#include#include#inclu...
分类:
其他好文 时间:
2015-04-15 22:55:12
阅读次数:
142
#include
#include
#include
#include
#include
using namespace std;
#define maxn 100000
int n, m, x[maxn];
int Max;
bool judge(int d)
{
int cnt = 1;
int a = x[0];
for(int i=1; i<n; i...
分类:
其他好文 时间:
2015-04-15 17:03:27
阅读次数:
120
题目大意:给你一串只有1,2的数字,让你改变最少的次数,让这个序列变成非递减的。
思路:动态规划,判断分界点,开一个dp[30010][2]的数组,其中dp[i][j]表示把第i个数改成j最少要花多少次
那么状态转移方程就列出来了:
令a=1 j!=a[i]
0 j==a[i]
那么dp[i][1]=dp[i-1][1]+a;
dp[i][2]=min(dp[i-1][1],dp[i-...
分类:
其他好文 时间:
2015-04-14 21:37:01
阅读次数:
137