- 博客(146)
- 收藏
- 关注
原创 Hdu 4732
题目链接::http://acm.hdu.edu.cn/showproblem.php?pid=4732 代码链接::https://github.com/Ronnoc/Training/blob/master/Hdu/4732.cpp Round Table N个点成环,选择M个点,最长连续选取长度要小于K. (1 在旋转同构的意义下种数有多少 选取的点称为黑点 不选取
2014-12-02 01:59:18
1285
原创 SPOJ TABLE
题目链接http://www.spoj.com/problems/TABLE/ vjudge链接http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=63819 代码链接
2014-11-05 00:52:57
776
转载 todo
1.burnside定理,polya计数法 这个大家可以看brudildi的《组合数学》,那本书的这一章写的很详细也很容易理解。最好能完全看懂了,理解了再去做题,不要只记个公式。 *简单题:(直接用套公式就可以了) *强烈推荐:(这题很不错哦,很巧妙) pku2888 Magic Bracelet http://162.105.81.212/Jud
2014-04-22 13:28:26
4776
转载 poj题目分类 很好很有层次感
OJ上的一些水题(可用来练手和增加自信) (poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094) 初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法.
2014-04-14 06:13:45
1398
原创 2014蓝桥杯本科C/C++组预赛第9题<斐波那契>解题报告
首先是题目链接 http://lx.lanqiao.org/problem.page?gpid=T121 如有错误,欢迎指出,讨论~ 蓝桥杯里面的数据相当水...很容易就能够水过去 现场思路 首先... 我们有矩阵快乘的方式可以O(logn)求出Fib[n]%mod 我的实现略有不同,本质一样 矩阵乘法之中会出现Ω(10^18)*Ω(10^18)%Ω(10^18) 直接乘
2014-03-26 20:38:06
6587
2
原创 Sgu 104
怎么说好呢 卡在101了 然后看104人多 开了发现是水的记录路径dp 但是写的太错了 WA,PE各种出 表示无语 今天多校的02也是 i,j的悲剧 一道题啊... 实在是... 实力不行... 感觉多校4/10过去了 实力没怎么提升的说 orz 吐槽完毕 水dp 鉴定完毕 dp[i][j]表示前i个花放到前j个花瓶中的最好结果 转移很好想 不过需要注意许多
2013-08-01 22:28:51
749
原创 最小长度电路板排列问题
85287Ronnoc10348GNU C++Accepted1284KB46ms2979B2013-07-31 01:02:09.0题目链接http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=10348终于过了。。。本来是过了多校03的1003想找个排列计数问题乱搞的结果搜到了这道题觉得还有点意思然后就从11点坑到了现在还好终于
2013-07-31 01:14:23
3024
原创 TC SRM580 DIV2
First TC SRM580 229.44(250)+316.29(500)+549.43(1000),rank 7 of div 2; rating 1708. 但愿这是唯一一场div2 250 交朋友,知道每个人出入时间,碰面就能交上朋友 直接n^2判断两个人是不是朋友就可以了 看到了很神的做法,以为是错的,有人cha挂了 s,t排序,t找s int ShoutterDi
2013-05-26 17:29:37
741
原创 Poj 2002 && 3432
1Y*2 相同题目 排序点 二分查找 n^2枚举对角线 #include #include #include struct point{ int x,y; bool operator <(const point &tp)const{ if(x!=tp.x)return x<tp.x; return y<tp.y; } bool operator ==(const poi
2013-05-16 10:42:36
688
原创 Poj 2299 Ultra-QuickSort
尼玛=,= 同样的程序 int n就是WA long long n就是AC 题目is so 坑 说着可怕 其实就是逆序对数 其实我是看到题目分类树状数组才想到这点的=,= 我们看到至少有一组逆序对是相邻的,否则已经单调上升 交换这组逆序对 逆序对数减一 仍至少有一组逆序对是相邻的 反复此操作 由于逆序对数P有限 至少P次使得逆序对数没有单调上升 所以P为所求 #
2013-05-16 10:13:45
672
原创 Poj 2388 Who's in the Middle
裸地中位数 sort1Y #include #include #include using namespace std; vectorL; int main(){ int n; while(scanf("%d",&n)!=EOF){ int i,x; L.clear(); for(i=0;i<n;i++){ scanf("%d",&x); L.push_back(x
2013-05-16 09:49:37
762
原创 Poj 1142 Smith Numbers
暴力 1WA于因数唯一的smith数处理 2Y #include #include int count(int y){ int res=0,tp=y; while(y){ res+=y%10;y/=10; } return res; } bool Smith(int x){ int left=count(x); int i,right=0; int tp=x;
2013-05-16 09:38:17
735
原创 Poj 2407 Relatives
欧拉函数题 裸地 题解了 关键在于1 这里以为会卡时限... 结果没有 一堆大质数能暴死 目测先指数判定 然后在for 就妥了 1Y #include #define ULL unsigned long long int main(){ int n; while(scanf("%d",&n)!=EOF&&n){ int i,tp=n; ULL res=n; f
2013-05-14 23:24:48
629
原创 Poj 1035 Spell checker
2Y 1TLE于用最长公共子序列处理相似问题 #include #include #include using namespace std; #define N 10010 char map[N][17]; char ask[60]; bool similar(char *map,char *ask){ int i,j; int len_map=strlen(map),len_ask=st
2013-05-14 22:26:37
635
原创 Poj 2506 Tiling
3Y 前导零wa1 a[0]wa1 ac 结构体内重载真忧伤 #include #include #include using namespace std; #define N 1010 struct BI{ int s[N]; int len; BI() {len=1;memset(s,0,sizeof(s));} BI operator = (cons
2013-05-14 20:01:33
647
原创 Poj 3318 Matrix Multiplication
随机算法 直接随机i,j会跪,因为可能只有一个格子不一样但是没有随机到 为了有效利用所有数据 (看了题解)可以构造列向量X,使得ABX=CX 利用了所有数据,很有效的O(n^2)判定 哪怕test=1都能过 很好奇test=1和test=10的时间为什么差距这么小... #include #include #include #define N 510 #define LL long
2013-05-13 23:46:26
707
原创 Poj 1149 PIGS
网络流的建模果然是一个难点 这倒题目貌似还是比较简单的建模 为了不继续在大物课上嚣张敲代码和自己已经没有思路了 就看的题解 从源点到中间节电的流量为每个猪库的猪数 也想到了可以转移的中间节点的流量为INF 也想到了代表顾客的点到汇点的流量是顾客需求 只是 中间节电构造没有想到 很pl的通过把顾客有钥匙 转化为那个猪库的钥匙在谁的手里 然后这个猪库就相当于在这帮有钥匙的人之间传
2013-05-08 16:24:12
715
原创 Poj 1087 A Plug For UNIX
2Y 1WA于以为插销只是一个字符 2Y 0ms Zoo 的隐藏boss读的题 自己建的模,还不错 虚拟总源点,总汇点 然后离散化所有的插座代号 有的插座作为汇点 有的电器作为源点 转换器的边流量为INF 以上 #include #include #include #include #include using namespace std; #define N 510 #de
2013-05-08 16:18:26
680
原创 Poj 1459 Power Network
几乎就是裸的最大流 对于多源点多汇点的最大流问题,只需要虚拟一个总源点总汇点即可 虽然之前在读题的时候想到了 这样描述出来是被题解第一行剧透的。。。 orz 1Y 用的是1273ditch的EK模板 1273就不放上来了,太水了。。。 #include #include #include #define INF (int)1e9 #define N 510 #define FOR(
2013-05-07 21:13:38
653
原创 CF 219D (#135div.2)D. Choosing Capital for Treeland
今天积分赛的最后一道题目 TLE是因为自己太二了... 总体的时间复杂度是O(n^2)而不是O(n); 因为in(u,v)的函数连二分都没有写...必须TLE orz... 真的是.... 好吧,,, 下次注意子函数的复杂度 好忧伤啊... 又优化了一下...G完全可以只存反向边...orz #include #include #include #define N 2000
2013-05-05 21:00:50
1003
原创 Poj 1797 Heavy Transportation
2Y 表示英文水平急剧下降.... 我的6级肿么办 到头来是最大生成树最短边 #include #include #include using namespace std; #define N 1010 #define INF (int)1e9 struct line{ int l,r,w; bool operator tp.w;} }tp; int ft[N]; int find(
2013-05-04 18:24:52
600
原创 Poj 1125 Stockbroker Grapevine
floyd模板提 居然0ms 同时也是英语阅读题.... google翻译什么的 3Y 表示没有判断n=0的情况break poj你到底是什么数据,,,, 然后disjiont注释掉也能过orz #include #include #include using namespace std; #define N 110 #define INF (int)1e9 int G[N][N]
2013-05-04 17:35:04
678
原创 Poj 2513 Colored Sticks
欧拉图判定(并查集,端点度数) 离散化Bsearch 1Y #include #include #include #include #define N 250003 using namespace std; struct chop{ char s[12]; bool operator < (const chop &tp)const{return strcmp(s,tp.s)<0;}
2013-05-03 22:49:58
631
原创 Poj 1308 Is It A tree
1WA于句末标点,ipad手打伤口不起 2Y 并查集 手写离散化 学会了vector的erase+unique的用法 #include #include #include #define N 10000+10 using namespace std; int ft[N]; int find(int x){ return (ft[x]==x) ? x : ft[x]=find(ft[x])
2013-05-02 16:49:09
559
原创 Poj 3468 A Simple Problem with Integers
需要lazy思想的线段树 原本都关机睡觉了,来了灵感,双重维护 听说过lazy的想法,实现方式是自己想到的,增量+子区间总和 5Y 3*TLE 1*WA 这个可以当做自己的模板了吧~~ TLE的关键点在于 insert和sum的结束条件都不能是T[w].l==T[w].r这样比O(n)的朴素算法还慢..貌似 想要加快sum,需要维护下段总和 想要加快insert,需要维护区间上
2013-05-02 00:30:35
568
原创 Poj 2352 Stars
nY 学习了下树状数组 手写的 大题能够理解 不过确实nb,,, ~~注意树状数组从1开始 0~32000是个trick 要++,注意改N的范围32001 #include int LB(int x){return x&(-x);} #define N 32001 int tree[32010]; void add(int w,int d){ for(;w<=N;w+=LB(w
2013-05-01 22:47:22
514
原创 Poj 2528 Mayor's posters
1MLE 2AC 3AC 学习了下线段树 还可以理解 第一次直接建树超内存 学习了下离散化,实际上就是把没出现过的点无视掉 第二次969ms飘过没有二分优化... 第三次63ms二分优化 好快=,= #include #include #include using namespace std; struct line{ int l,r; int x; }L[1<<16];
2013-05-01 18:20:30
534
原创 Poj 2262 Goldbach's Conjecture
哥德巴赫猜想验证 自检是否是质数会tle(1TLE && 2TLE) 手写自底向上生成质数表 3 AC #include int isp[1000010]; int p[90000]; int main(){ int i,j; isp[1]=0; for(i=2;i<=1000000;i++)isp[i]=-1; for(i=2;i<=1000000;i++){ if
2013-05-01 13:41:15
627
原创 第十一届北师大程序设计竞赛 by Zoo
现场赛 team06 BJTU-01 队员:Ronnoc(5),MuQ~(4) 总共9 of 12 rank 1 以为被北航逆袭了 结果过了D的不是他们 榜单出来了...http://www.bnuoj.com/bnucpc/summary.htm 某北航罚时还被超了... 第一妥妥的 感觉3个没有出来的题DEG D是树,E是贪心+搜索,G是搜索 没有全场的FB,只有I是局
2013-04-30 18:47:15
763
原创 poj 1861 Network
最小生成树,要求构建和最大边最小 1Y 实例有一条边没用 不过不影响 #include #include #include #include #define MAX 1010 using namespace std; struct edge{ int p,q; int w; int ok; bool operator < (const edge& b)const { retur
2013-04-29 20:47:34
569
原创 Poj 1789 Truck History
1Y prim模板一套 完事大吉 #include #include #include #define INF ((int)1e9) #define N 2010 using namespace std; int G[N][N]; int low[N]; char map[N][10]; int cmp(int x,int y){ int len=strlen(map[x]);
2013-04-29 20:34:44
593
原创 Poj 2485 Highways
Prim 最小生成树的最长边 1Y 改改模板就过了 #include #include #define INF ((int)1e9) #define N 510 using namespace std; int G[N][N]; int low[N]; int main(){ int n; int T; scanf("%d",&T); while(T
2013-04-29 20:29:08
546
原创 Poj 1258 Agri-Net
裸的最小生成树 学习了下prim 裸打的1Y #include #include #define INF ((int)1e9) #define N 110 using namespace std; int G[N][N]; int low[N]; int main(){ int n; while(scanf("%d",&n)!=EOF){ int i,j;
2013-04-29 20:22:25
569
原创 Poj 1251 Jungle Roads
最小生成树 Kruskal oj有bug RE3次因为scanf 第一次用cin输入 没问题 貌似是输入的问题 以上 #include #include #include #include #define MAX 800 #include using namespace std; struct edge{ int p,q; int w; bool operator < (co
2013-04-29 19:52:17
587
原创 Poj 2253 Frogger
1WA于最小生成树改用floyd 2WA于%.3lf 3PE于没有数据间回车 4AC #include #include #include using namespace std; #define MAX 210 #define INF 1e20 double G[MAX][MAX]; double x[MAX],y[MAX]; double dis(int p,int q){ d
2013-04-29 19:24:19
559
原创 Uva 10397 - Connect the Campus
1Y 并查集+最小生成树 #include #include #include #include #define MAX 800 struct edge{ int p,q; double w; bool operator < (const edge& b)const { return w<b.w; } }; std::vectorL; int ft[MAX]; void in_
2013-04-29 18:59:43
646
原创 Poj 2965 The Pilots Brothers' refrigerator
貌似提交了很多次 估计有段时间special judge挂了... 就WAWAWA... tle于直接搜2^16*16 firstAC于2^15*16; next AC 于 2^12*16 搜索剪枝还是很重要的! #include const int search_size=1<<12; int Cg(char x){ if(x=='+')return 1; return 0;
2013-04-29 14:02:21
509
原创 Poj 1088 滑雪
1Y DAG最长路 #include #include int h[105][105]; int dp[105][105]; int dx[]={1,-1,0,0}; int dy[]={0,0,1,-1}; int n,m; int can(int x,int y){ if(x<0||y<0)return 0; if(x>n||y>m)return 0; return 1; } in
2013-04-28 21:01:33
539
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅