摘要: HUD-3507 Zero has an old printer that doesn't work well sometimes. As it is antique, he still like to use it to print articles. But it is too old to w 阅读全文
posted @ 2020-12-18 17:15 肆之月 阅读(71) 评论(0) 推荐(0) 编辑
摘要: P4544 [USACO10NOV]购买饲料Buying Feed 约翰开车来到镇上,他要带KK吨饲料回家。运送饲料是需要花钱的,如果他的车上有XX吨饲料,每公里就要花费$X2$ 元,开车D公里就需要$D\times X2$ 元。约翰可以从N家商店购买饲料,所有商店都在一个坐标轴上,第ii家店的位置 阅读全文
posted @ 2020-12-18 17:13 肆之月 阅读(73) 评论(0) 推荐(0) 编辑
摘要: Test for Job Mr.Dog was fired by his company. In order to support his family, he must find a new job as soon as possible. Nowadays, It's hard to have 阅读全文
posted @ 2020-12-18 17:12 肆之月 阅读(61) 评论(0) 推荐(0) 编辑
摘要: Delete 题目描述 给定一张n个点,m条边的带权有向无环图,同时给定起点S和终点T,一共有q个询问,每次询问删掉某个点和所有与它相连的边之后S到T的最短路,询问之间互相独立(即删除操作在询问结束之后会立即撤销),如果删了那个点后不存在S到T的最短路,则输出-1。 输入描述: 第一行四个正整数表示 阅读全文
posted @ 2020-12-18 17:11 肆之月 阅读(108) 评论(0) 推荐(0) 编辑
摘要: MMSet2 给定一棵n个节点的树,点编号为1…n。 Q次询问,每次询问给定一个点集S,令,\(f(u)=\max_{v\in S}dist(u,v)\) 你需要求出$\min_f(u)$ 其中dist(u,v)表示树上路径(u,v)的边数。 输入描述: 第一行一个整数n,接下来n−1行每行两个整数 阅读全文
posted @ 2020-12-18 17:08 肆之月 阅读(190) 评论(0) 推荐(0) 编辑
摘要: POJ3071 Description Consider a single-elimination football tournament involving $2n$ teams, denoted $1, 2, …, 2n$. In each round of the tournament, al 阅读全文
posted @ 2020-12-18 17:06 肆之月 阅读(73) 评论(0) 推荐(0) 编辑
摘要: 高斯消元 时间复杂度:\(O(n^3)\) /* n行:[0,n) m列:[0,m) m=2n时,右侧矩阵是左侧矩阵的逆 m=n+1时,右侧一列是左侧方程组的解 */ //double double a[][]; bool gauss(int n,int m){ for(int i=0,r=0;i< 阅读全文
posted @ 2020-12-18 17:03 肆之月 阅读(133) 评论(0) 推荐(0) 编辑
摘要: You Are the One The TV shows such as You Are the One has been very popular. In order to meet the need of boys who are still single, TJUT hold the show 阅读全文
posted @ 2020-12-18 16:59 肆之月 阅读(88) 评论(0) 推荐(0) 编辑
摘要: struct pt{ double x,y; }k[MAXN]; bool cross(const pt&a,const pt&b,const pt&z){//za叉乘zb向量 return (a.x-z.x)*(b.y-z.y)-(a.y-z.y)*(b.x-z.x)>=0; } bool cmp 阅读全文
posted @ 2020-12-18 16:57 肆之月 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 代码: char s[MAXN],p[MAXN];//在s里找子串p int n,m,nxt[MAXN];//前缀函数nxt[i]:p中[0,nxt[i]-1]==[i-nxt[i]+1,i] void get_next() { for(int i=1,j=0;nxt[i]=0,i<m;++i) { 阅读全文
posted @ 2020-12-16 19:01 肆之月 阅读(65) 评论(0) 推荐(0) 编辑