上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页
摘要: 题意 N个人,每个人有一个属性(x,y), 若对于一个人P(x,y),不存在P`(x`,y`)使 x`< x , y` <= y or x` <= x , y` < y , 则认为 P是有优势的.问逐一的输入N个人信息,在当前情况下有优势的人的数量.解题思路 若添加当前人信息进入, P(x,y), 其可能有两种情况: 1. 若 存在 P`(x`,y`), 使得 x`<x,y`<=y or x`<=x,y`<y, 则P无优势,则不必加入. 2. 若其不存在则其 有优势,并会导致部分点失去优势,将那些点删除. 这里 通过 <x,y> 进行 阅读全文
posted @ 2013-04-08 19:04 yefeng1627 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Splay 概念文章:http://blog.csdn.net/naivebaby/article/details/1357734叉姐 数组实现:https://github.com/ftiasch/mithril/blob/master/2012-10-24/I.cpp#L43Vani 指针实现:https://github.com/Azure-Vani/acm-icpc/blob/master/spoj/SEQ2.cpphdu 1890 写法:http://blog.csdn.net/fp_hzq/article/details/8087431HH splay写法:http://www.n 阅读全文
posted @ 2013-04-07 21:59 yefeng1627 阅读(1471) 评论(0) 推荐(0) 编辑
摘要: int gcd( int a, int b ){ if( a == 0 ) return b; if( b == 0 ) return a; if( a%2 == 0 && b%2 == 0 ) return 2*gcd( a/2, b/2 ); else if( a%2 == 0 ) return gcd( a/2, b ); else if( b%2 == 0 ) return gcd( a, b/2 ); else return gcd( abs(a-b), min(a,b) );... 阅读全文
posted @ 2013-04-07 13:18 yefeng1627 阅读(113) 评论(0) 推荐(0) 编辑
摘要: A Jason的特殊爱好 组合数学, 通过计算 [1,n]区间数量解决. 假设n十进制表示位数为L,则通过统计长度为 L, L-1, ..., 1的数量来得出结果. 假设 n = a1,a2,a3,...,aL // 十进制表示,其中a1为高位 一.当长度小于L, 假设其为 len = 1,2,...,L-1 则当前数 X = a1,a2,a3,...,a_len 因为 Length(X) < Length(N), 所以任意的X都小于N, 我们可以枚举 X中包含的1的个数,假设其为 K, 则 K = 0,1,2,...,len... 阅读全文
posted @ 2013-04-06 18:32 yefeng1627 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 一, Sequence SearchView Code // Sequence_Search// yefeng1627#include<stdio.h> #include<stdlib.h>#define True 1#define False 0#define MaxLength 100typedef int KeyType;typedef int DataType;typedef struct{ KeyType key; //关键字域 DataType other; //其它属性域 }ElemType;typedef struct{ ElemType... 阅读全文
posted @ 2013-04-05 22:29 yefeng1627 阅读(395) 评论(0) 推荐(0) 编辑
摘要: 未解决的题 F.Arrange Books并查集+树状数组。如果不考虑抽出书本的操作,这是一道相对简单的并查集题目,只需给每本书再开一个域,记录其上有多少本书即可。我们发现,当书堆起来的时候,可以按照从上到下的顺序给每本书重新编号,如果抽出一本书,则可以在这本书的新编号上标记-1,表示删除。如果要统计书本i(设书本i的新编号为y)上有多少本书,则可以把它最上面的那本书的新编号x找出来,数x到y之间有多少本书被删掉,然后就能得解。从这时候想到了什么?树状数组!所以,我们先把所有操作存起来,然后进行一次堆书的操作,这时候不考虑抽出书,根据最后的书在各自书堆的顺序,给一个新编号。最后,重新进行一次. 阅读全文
posted @ 2013-04-05 22:11 yefeng1627 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 题目 给N个name ,与N个id, 及其之间关系, 求唯一匹配解法 删除边(u,v)后若匹配数减小,则证明此边必定为唯一匹配。 时间复杂度有点高。View Code #include<cstdio>#include<cstring>#include<cstdlib>#include<algorithm>#include<string>#include<map>#include<iostream>using namespace std; map<string,int> mp_name,mp_id;c 阅读全文
posted @ 2013-04-04 12:55 yefeng1627 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 题目大意 N件物品, 每件物品价值为a[i],数量为b[i], 问分成两堆差值尽量小.解题思路 感觉像是多重背包的变形~~~ 状态DP[N][V]表示,前i件物品,价值为V的方案数 转移方程 dp[i][ j+k*a[i] ] += dp[i-1][j] // k = 0..b[i] #include<stdio.h>#include<stdlib.h>#include<string.h>const int N = 250010;int dp[2][N];int main(){ int a[110], b[110], n; while( scanf(&quo 阅读全文
posted @ 2013-04-03 20:30 yefeng1627 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 对于路径覆盖概念请点击以下链接: Path Cover#include<stdio.h>#include<stdlib.h>#include<string.h>const int N = 150;int n, m;int ma[N],mb[N];bool g[N][N], vis[N];int path( int u ){ for(int v = 1; v <= n; v++){ if( g[u][v] && !vis[v] ){ vis[v] = 1; if( ma[v] == -1 || path( ma[v] )){ ... 阅读全文
posted @ 2013-04-03 19:41 yefeng1627 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 题意 一个序列,求其所有长度为k的子序列最大最小值解法 单调队列维护最大最小。平摊时间复杂度到O(1)这题T了几次,因为C++,G++编译器不同的缘故。 感谢 纳米,科普。 具体见下yefeng1627(361072774) 19:06:28 求解 c++ 与 g++ (GUN c++)yefeng1627(361072774) 19:06:45 这个是为什么? 好像记得去年暑假HDU多校也有过这样的事情...yefeng1627(361072774) 19:06:53 有一题~~纳米(549950130) 19:07:05 所谓C++... 一般都是指VC..ye... 阅读全文
posted @ 2013-04-03 19:15 yefeng1627 阅读(192) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页

Launch CodeCogs Equation Editor