There are N seaside villages on X island, numbered from 1 to N. N roads
are built to connect all of them, which are also numbered from 1 to N, and the road with number i connects
the village i and...
分类:
其他好文 时间:
2015-06-11 09:38:52
阅读次数:
80
Description:The best friends Mr. Li and Mr. Liu are touring in beautiful country M.M has n cities and m two-way roads in total. Each road connects two...
分类:
编程语言 时间:
2015-06-10 20:43:41
阅读次数:
185
计算距离时平方爆了int结果就WA了一次......-----------------------------------------------------------------------------------------#include#include#include#include#in...
分类:
其他好文 时间:
2015-06-07 17:25:01
阅读次数:
110
#include
using namespace std; //BFS+优先队列(打印路径)
#define N 500005
int c[N];
int dp[N]; //dp[i]保存的是长度为i的最长不降子序列的最小尾元素
int BS(int n,int x) //二分查找下标,当x比所有元素小时下标为1,比所有元素大时下标为n+1.
{
int low,high,mid;
...
分类:
其他好文 时间:
2015-06-06 13:35:52
阅读次数:
150
题意:在马路两边分别有n个城市,给出期望的n条路用于连接两边的城市,但是要求路不能有交叉,求在期望的n条中路实际能保留下来的最大的条数
分析:这题很好
1.本题抽象出来的模型应该是求最长上升(不下降)子序列
2.LIS的 nlog(n)算法:
O(n^2) 的算法是dp[i]保留以i结尾的最长上升子序列的长度,令k=dp[i],O(nlog(n))算法是从k的角度出发,设d(k)为在长度为...
分类:
编程语言 时间:
2015-06-06 09:20:01
阅读次数:
130
题目链接:http://acm.acmcoder.com/showproblem.php?pid=1025题意:本求最长公共子序列,但数据太多。转化为求最长不下降子序列。太NB了。复杂度n*log(n).解法:dp+二分代码:#include
#include
#include
#include
#include...
分类:
其他好文 时间:
2015-06-05 17:31:32
阅读次数:
116
DescriptionByteotia城市有n个 towns m条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的road. 所有towns连通。Input输入n 2 #include 3 #define ll long long 4 using namespace st...
分类:
其他好文 时间:
2015-06-04 22:34:21
阅读次数:
162
Description
Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <...
分类:
其他好文 时间:
2015-06-03 21:38:18
阅读次数:
143
I am going to my home. There are many cities and many bi-directional roads between them. The cities are numbered from 0 to n-1 and each road has a cost. There are m roads. You are given the number of m...
分类:
其他好文 时间:
2015-06-02 22:03:57
阅读次数:
175
Constructing RoadsTime Limit:2000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusPracticePOJ 2421Appoint description:DescriptionThere a...
分类:
其他好文 时间:
2015-06-02 21:40:47
阅读次数:
115