![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM简单题
文章平均质量分 66
wb_james
本科
展开
-
Freckles
Description In an episode of the Dick Van Dyke show, little Richie connects the freckles on his Dads back to form a picture of the Liberty Bell. Alas, one of the freckles turns out to be a scar, so原创 2009-09-30 11:32:00 · 965 阅读 · 0 评论 -
Minimal search cost DP+平行四边形优化
Minimal search costTime Limit : 10000/4000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 19 Accepted Submission(s) : 12Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem Description As we know, we need to spe原创 2010-08-29 13:15:00 · 1725 阅读 · 0 评论 -
hdu3584 Cube 树状数组
<br /> Cube<br />Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)<br />Total Submission(s): 48 Accepted Submission(s): 32<br />Problem DescriptionGiven an N*N*N cube A, whose elements are either 0 or 1. A[i, j, k] mea原创 2010-08-31 21:04:00 · 538 阅读 · 0 评论 -
HDU 2419 Boring Game
十分悲剧,无线蛋疼,昨天纠结一天! 就因为modify(que[i].v1,ri[que[i].v1][cnt[que[i].v1]],ri[que[i].v1][cnt[que[i].v1]-1])+cnt[que[i].v1]用modify(que[i].v1,ri[que[i].v1][cnt[que[i].v1]],ri[que[i].v1][-- cnt[que[i].v1]])代替,估计是调用函数的执行顺序有关系;情何以堪!#include#include#include#include#inc原创 2010-09-09 11:02:00 · 825 阅读 · 0 评论 -
九月的哈尔滨
先写个标题吧!原创 2010-09-28 12:03:00 · 2053 阅读 · 6 评论 -
FZU 网赛最后K题 Three kingdoms(有点卡常数的)
<br />题目意思大致是:给出N个点,然后给出方向向量,然后N个点沿着方向向量引出射线,在m个点(敌人),凡是被射线射到的要死,问最后死多少人。。 n,m都是(0,10000]的。<br /> 显然,时间复杂度很明显,不是O(n)就是O(nlog(n) ),我做的是O(nlog(n) )复杂度的,首先我们想到的是每一个射线的起点与X * Y这个平面上延着向量的方向或反方向有个交点(特殊情况,如方向向量平行x * y的话 我们可以通过反转避免); 然后我们用O(n)的复杂度处理了起点,然后对所有在X上的映原创 2010-10-11 11:50:00 · 764 阅读 · 0 评论 -
啊啊啊!!本来CF34可以AK的。。。
<br />while(true)<br />RP++;原创 2010-10-11 23:56:00 · 557 阅读 · 1 评论 -
HDU 2295(裸DLX要超时,需要剪枝)
<br /> <br />多了Judge()要是depth+judge()都大于count就直接返回false;<br /> <br /><br />#include <iostream><br />#include <cmath><br />#include <stdio.h><br />using namespace std;<br /> <br />const int N=100;<br />struct node{<br />int L,R,D,U,col;<br />}dia[N*N];<br /原创 2010-10-15 23:00:00 · 884 阅读 · 0 评论 -
DP(斜率优化)
Print Article悲剧。不是数组写小就是小于号写反。。。明天比赛,期待RP爆发!#include #include using namespace std;const int N=500010;__int64 dp[N];__int64 sum[N],dia;int Q[N];int n,m;__int64 cal(int c,int k){ return dp[c]+(sum[k]-sum[c])*(sum[k]-sum[c])+m;}__int64 Y(int c){ return原创 2010-10-23 22:48:00 · 791 阅读 · 3 评论 -
打酱油了。。。
<br />:(原创 2010-10-24 18:25:00 · 546 阅读 · 3 评论 -
杭州-打酱油!
<br /><br />在杭州的两天都是下着雨的,阴霾的天气不及现在我的mood。<br /> 星期五出发来杭州,也算倒霉了,想动车去。。然后坐车到了东站,结果车票已经卖完。<br />然后决定大巴去了。。去了客运中心,发现大巴在南站坐。。又悲剧。。11点多出来,2点才从宁波出发。<br />在杭州酒店里遇到了正在杭州开会的班主任。<br /> 星期六,是个下雨天,简单开幕式后乘车去阿里巴巴,坐了一个多小时后才到它的总部,然后<br />直接上光明鼎参观,很震撼!阿里巴巴的工作氛围很好,真希望以原创 2010-10-24 20:15:00 · 983 阅读 · 0 评论 -
杭州地区赛的遗憾 Rotational Painting
<br />题目其实稍微注意一下就知道怎么搞了。<br />重心+凸包!<br />然后枚举相邻凸点就行<br /> <br />#include <iostream><br />#include <algorithm><br />using namespace std;<br />#define N 50005<br />/*==================================================*/ <br />| Graham 求凸包 O(N * logN) <br />|原创 2010-11-07 15:08:00 · 1120 阅读 · 0 评论 -
poj 2503 Babelfish
本来想试试那个ELFHash算法的功力的,哪知道错了,还是我三行的hash好。。。#include #include #include #include using namespace std;map M;int ELFHash(const char * st原创 2011-10-11 00:09:49 · 505 阅读 · 0 评论 -
zoj 3540 Adding New Machine
=。=!全STL搞的。。离散化后扫描线+Set..#include #include #include #include using namespace std;#define mp(a,b) make_pair(a,b)typedef long lo原创 2011-10-04 22:24:46 · 1227 阅读 · 0 评论 -
求树的直径
偶尔看到的题目,顺便练习下指针。。#include using namespace std;typedef struct node { int data; int child_num; node **childs;}*tree;/*求tree t的高原创 2011-10-07 21:35:28 · 1374 阅读 · 2 评论 -
天津网络预选赛 1007-Giant_For(线段树+set)
已行x区间内最大的列为键值构建线段树,再以set维护每个点中的y值。find的话查找【x+1,n】中最小的点,该点的最大列值是大于y的;然后返回的是x的位置,再从x的set里取出最小的一个比y大的值!#include#include#include#includeusing namespace std;struct Seg{int l,r,max_col;};struct Q{char ch[8];int row,col;};Q q[200010];Seg seg[200010*3];int dia[200原创 2010-09-12 18:42:00 · 993 阅读 · 2 评论 -
hdu 3506Monkey Party(环形DP+平行四边形优化)
<br /><br />#include<iostream><br />using namespace std;<br /> <br />const int N=2010;<br />int sum[N];<br />int n;<br />int dia[N];<br />int s[N][N];<br />int dp[N][N];<br /> <br />void init()<br />{<br />int i;<br />sum[0]=0;<br />memset(dp,0xf,sizeof(dp原创 2010-08-24 22:07:00 · 1387 阅读 · 1 评论 -
武汉1006 GCC
Problem DescriptionThe GNU Compiler Collection (usually shortened to GCC) is a compiler system produced by the GNU Project supporting various programming languages. But it doesn’t contains the mat原创 2009-10-03 22:24:00 · 3386 阅读 · 0 评论 -
hdu1060 Leftmost Digit(转载)
Problem DescriptionGiven a positive integer N, you should output the leftmost digit of N^N. InputThe input contains several test cases. The first line of the input is a single integer T whi原创 2009-10-06 23:03:00 · 480 阅读 · 0 评论 -
线段树 (第一次尝试)
ATime Limit:10000MS Memory Limit:65536KTotal Submit:94 Accepted:32 Description 有n(1Input 输入由多组数据组成。每组数据,第1行输入一个数n;第2行输入n个整数,每个数后用空格隔开,分别表示a1,a2,……,an-1,an;第3行输入一个m。第4到m+3行,每行输入两个整数s和t(1Ou原创 2009-10-15 09:51:00 · 470 阅读 · 0 评论 -
线段树之(二) hdu1754 I Hate It
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0学生ID编号分别从1编到N。第二行包含N个整数,代表这N原创 2010-02-10 12:03:00 · 506 阅读 · 0 评论 -
激动——第一次用类来A题!纪念下hdu 1575
#includeusing namespace std;class matrix {public: int m[12][12]; int o[12][12]; int f[12][12]; int n,cnt;public: void work(int c); void findans(); void init();};void matrix::init(){ for(int i=1;i原创 2010-03-18 10:04:00 · 365 阅读 · 0 评论 -
hdu 3367 Pseudoforest
PseudoforestTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 87 Accepted Submission(s): 21Problem DescriptionIn graph theory, a pseudof原创 2010-04-04 00:09:00 · 1142 阅读 · 0 评论 -
hdu 3376 Matrix again
Matrix AgainTime Limit: 5000/2000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others)Total Submission(s): 368 Accepted Submission(s): 119Problem DescriptionStarvae very like play原创 2010-04-07 09:33:00 · 1264 阅读 · 0 评论 -
浙江理工邀请赛 后感
刚收到消息了,有牌了!虽然是块含金量最低的牌,但总比省赛打酱油的好多了。这次比赛,感觉很好,浙江理工,杭州下沙,我弟弟的学校,5.7号下午一点出发,3点多到的下沙,下榻在凯恩戴斯大酒店。这次比赛都是在食堂吃,相比较住在准五星的大酒店,这个感觉就是稍微有点小失望。吃好晚饭后我们就开始逛下沙,不得不值得一说的是,我们在逛这理工的后花园的时候遇到世界第六,现远不止世界第六的hhanger大原创 2010-05-09 19:54:00 · 2526 阅读 · 3 评论 -
Color a Tree
<br />Poj2054 Color a Tree2008-09-14 23:42Color a TreeTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 2095 Accepted: 564<br />DescriptionBob is very interested in the data structure of a tree. A tree is a directed graph in which a special node原创 2010-07-19 21:59:00 · 762 阅读 · 0 评论 -
Color a Tree
<br />Poj2054 Color a Tree2008-09-14 23:42Color a TreeTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 2095 Accepted: 564<br />DescriptionBob is very interested in the data structure of a tree. A tree is a directed graph in which a special node原创 2010-07-19 21:59:00 · 992 阅读 · 0 评论 -
基础线段树
<br /> <br />Balanced Lineup<br />Time Limit:5000MS Memory Limit:65536K<br />Total Submit:35 Accepted:22 <br />Case Time Limit:2000MS<br />Description<br />For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order.原创 2010-08-03 15:08:00 · 481 阅读 · 0 评论 -
A Game with Colored Balls 郁闷,一个早上加一个晚上=Wa (再加一早上 AC)
#include#include#include#include#includeusing namespace std;#define N 10000002struct node{char ch;int pos,num,pre,next;friend bool operator{if(a.num==b.num)return a.poselsereturn a.num>b.num;}};struct sun{int pos,pre,next;};node dia[N+1],tt,pp;char s[N+1];原创 2010-08-14 23:28:00 · 635 阅读 · 0 评论 -
hdu 字典树Ancient Printer
<br />跟着别人做也会被误导的啊,这题做掉的人很快很多,以为排排序之类的就会出来的,后来还拼命的在往简单的想,导致悲剧无限。<br />后来乱七八糟搞了下,原来是最简单的字典树;<br />思路:我们简单的想象一下,把所有要打印的东西构建成一颗字典树的话,若最后要求的是最后打印过的东西都要删掉的话,我们要在树上走的次数是所有的边都需要走两次。但现在是最后一次打印之后不需要DELETE,就是说最后一次到达叶子结点时不需要返回到根结点,于是,我们贪心的可以把最长的一条到达叶子的路放在最后(只需要走一次)。<原创 2010-08-16 21:08:00 · 575 阅读 · 0 评论 -
zju3381Osaisen Choudai!
<br />dp+线段树;<br />dp[i] = s[i] + max{dp[i + j] | x[i] ≤ j < y[i]}<br />用线段数维护max。<br /> <br /> <br />#include<iostream><br />using namespace std;<br /> <br />const int N=50000;<br />struct node<br />{<br />int left,right;<br />int ma;<br />};<br />struct原创 2010-08-23 21:18:00 · 575 阅读 · 0 评论 -
3547 The Boss on Mars
#include #include #include using namespace std;typedef long long LL;const int MAXN = 10001;const LL M = 1000000007;int factor[10001]原创 2011-10-08 21:30:28 · 707 阅读 · 0 评论