文章列表
//神一样的思想,神一样的代码,我佩服的五体投地!!
//题目给出五个正整数n,m,k,s,t。n表示n星球,m表示m个双向隧道,
//k,s,t表示要把k个电脑从s星球运到t星球,双向道只能单行,走一条
//道用时一天,求最短时间,并输出运输方案。
//分析:
//假定T天可以运完,可以吧每个点u拆分成T+1个,分别为u0,u1。。。
//u0是初始状态,u1是一天后的状态,对于相邻的a,b。a0到b1有一条
//容量为1的边,b0到a1也有一条,a0到a1有一天容量为INF的路,表示不动。
//用模板求出最大流,如果达到了k就输出T,达不到就T++;
#inclu ...
UVA11248 最大流ISAP模板
- 博客分类:
- 最大流
//题意:给定一个有向网络,每条边均有一个容量。问是否存在一个从点1到点N,流量为C的流。
//如果不存在,是否可以恰好修改一条弧的容量,使得存在这样的流?
//
//分析:先求一次最大流,如果流量至少为C,则直接输出possible,否则需要修改的弧一定是最小割里的弧。
//依次把这些弧的容量增加到C,然后再求最大流,看最大流量是否至少为C即可。
//很可惜,这样写出来的程序会超时,还需要加两个重要的优化。第一个优化是求完最大流后把流量留着,以
//后每次在它的基础上增广,第二个优化是每次没必要求出最大流,增广到流量至少为C时就停下来
#include<cstdi ...
Minimum Inversion Number
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 474 Accepted Submission(s): 217
Problem Description
The inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i < ...
统计难题
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 2947 Accepted Submission(s): 1038
Problem Description
Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).
Input
输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10 ...
敌兵布阵 线段树 变点问区间
- 博客分类:
- 数据结构
敌兵布阵
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2175 Accepted Submission(s): 811
Problem Description
C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚, ...
Human Gene Functions
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 451 Accepted Submission(s): 277
Problem Description
It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply den ...
N!
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11591 Accepted Submission(s): 2860
Problem Description
Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!
Input
One N in one line, process to the end of file.
Ou ...
连接:http://poj.org/problem?id=3164
Command Network
Time Limit: 1000MS
Memory Limit: 131072K
Total Submissions: 10061
Accepted: 2930
Description
After a long lasting war on words, a war on arms finally breaks out between littleken’s and KnuthOcean’s kingdoms. A sudden and ...
连接:http://poj.org/problem?id=2914
Minimum Cut
Time Limit: 10000MS
Memory Limit: 65536K
Total Submissions: 6407
Accepted: 2665
Case Time Limit: 5000MS
Description
Given an undirected graph, in which two vertices can be connected by multiple edges, what is the size of ...
连接:http://poj.org/problem?id=2449
Remmarguts' Date
Time Limit: 4000MS
Memory Limit: 65536K
Total Submissions: 17237
Accepted: 4727
Description
"Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his littl ...
南阳理工OJ 99 单词拼接(欧拉通路)
- 博客分类:
- 图的遍历
连接:http://acm.nyist.net/JudgeOnline/problem.php?pid=99
单词拼接
时间限制:3000 ms | 内存限制:65535 KB
难度:5
描述
给你一些单词,请你判断能否把它们首尾串起来串成一串。
前一个单词的结尾应该与下一个单词的道字母相同。
如
aloha
dog
arachnid
gopher
tiger
连接:http://acm.nyist.net/JudgeOnline/problem.php?pid=697
The Weight of Tree
时间限制:3000 ms | 内存限制:65535 KB
难度:4
描述
456 has a tree of n nodes, each node is assigned with an integer number. Now 456 wants to select a subtree, such that the sum of all integers on the nodes of the subtree ...
连接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=560&problem=2414&mosmsg=Submission+received+with+ID+11685942
Problem CSAM I AMInput: Standard Input
Output: Standard Output
The world is in great danger!! Mental's forces ...
连接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=560&problem=4157&mosmsg=Submission+received+with+ID+11685541
Young naturalist Bill studies ants in school. His ants feed on plant-louses that live on apple trees. Each ant colo ...
连接:http://acm.hdu.edu.cn/showproblem.php?pid=2255
奔小康赚大钱
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1805 Accepted Submission(s): 786
Problem Description
传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家 ...