自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(201)
  • 收藏
  • 关注

原创 [kuangbin带你飞]专题四 最短路练习-G

题意:题意:信息传输,总共有n个传输机,先要从1号传输机向其余n-1个传输机传输数据,传输需要时间,给出一个严格的下三角(其实就是对角线之下的不包括对角线的部分)时间矩阵,a[i][j]代表从i向j传输数据需要的时间,并规定数据传输之间并无影响,即第一个传输机可以同时向其余传输机传输数据。求所有传输任务所需的最短时间。tip:我知道这道题查体题姐估计都是看不懂题orz http://poj.org

2016-12-14 19:27:31 239

原创 [kuangbin带你飞]专题四 最短路练习 -F

http://poj.org/problem?id=3259题意:有的边是负数,问从一点出发能不能用小于0的时间回去tip:路是双向,虫洞单向,其他模板。。。要气死了。。。。双向着了1h错误#include <cstdio>#include <iostream>#include <cstring>#include <queue>using namespace std;queue<int>q

2016-12-14 11:29:28 273

原创 [kuangbin带你飞]专题四 最短路练习-E

http://poj.org/problem?id=1860 DescriptionSeveral currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operat

2016-12-13 21:05:44 421

原创 cf#383 div2(ABCDE)

A题:题意:1378的n次方最后一位tip:8 4 2 6循环,hack点:0次方是1 (栗子同学直接快速幂。。。巧妙避开)#include <cstdio>#include <iostream>#include <cstring>using namespace std;int main(){ int ans,n; scanf("%d",&n); if(n == 0)

2016-12-08 18:12:17 296

原创 [kuangbin带你飞]专题四 最短路练习D

Description One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirectional

2016-12-03 10:50:11 261

原创 [kuangbin带你飞]专题四 最短路练习 C

http://poj.org/problem?id=1797 Description Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether

2016-12-03 01:05:45 319

原创 cf#381D 树状数组+二分

http://codeforces.com/contest/740/problem/D之前就学过一些树状数组,但仅限于单点修改,区间查询。。 树状数组到底是怎么回事 搞懂树状数组原理 大神说的很清楚辣,简单的说就是开一个新数组利用二进制记录原数组某几个的和,最后实现快速的求任意区间的和,突然想起当年图卡的1248码。 当知道了树状数组是求区间和很快很方便之后,对于区间修改,单点询问i,可以

2016-12-02 11:08:31 410

原创 姿势

http://blog.csdn.net/jzhang1/article/details/50535800http://blog.csdn.net/ac_gibson/article/details/41624623http://blog.csdn.net/sjkldjflakj/article/details/52170747http://www.matrix67.com/blog/archive

2016-12-01 23:23:26 394

原创 三块不相交的k*k方格中数和的最大值(dp)

https://vijos.org/p/2002 Siruseri政府决定将石油资源丰富的Navalur省的土地拍卖给私人承包商以建立油井。被拍卖的整块土地为一个矩形区域,被划分为M×N个小块。 Siruseri地质调查局有关于Navalur土地石油储量的估测数据。这些数据表示为M×N个正整数,即对每一小块土地石油储量的估计值。为了避免出现垄断,政府规定每一个承包商只能承包一个由K×K块相连的土地

2016-12-01 18:24:51 619

原创 ()

http://www.swunacm.com/acmhome/problemdetail.do;jsessionid=3DC8B58CA070D3EDF7ACD1B6DAE0DFE3?&method=showdetail&id=1865http://acm.timus.ru/problem.aspx?space=1&num=1873

2016-12-01 16:19:02 221

原创 ural1752找树上距某个点某距离的点(树的直径+倍增)

http://acm.timus.ru/problem.aspx?space=1&num=1752Consider a tree consisting of n vertices. A distance between two vertices is the minimal number of edges in a path connecting them. Given a vertex vi an

2016-12-01 16:15:21 519

原创 LCA

http://codeforces.com/contest/519/problem/E题意:给你一个无根树,q个询问,每次输入两个节点,问到两个节点距离相同的点有几个tip:设1为根,dfs记录每个点子树的节点数量,每个点的高度, 倍增,找到u,v的lca,根据三个点的高度可以知道在从u到v的链上到两个点距离相等的点的高度, if(lca不是这个中间点且长度是偶数,那么这个中间点的所有子树除了这

2016-11-30 13:56:52 491

原创 [kuangbin带你飞]专题四 最短路练习 B

真的不知道要败给读题到什么时候。。。http://poj.org/problem?id=2253 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to vis

2016-11-30 11:46:02 344

原创 [kuangbin带你飞]专题四 最短路练习 A

Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of t

2016-11-29 23:18:31 343

原创 [kuangbin带你飞]专题一 简单搜索 M

大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S<101)毫升 (正好装满一瓶) ,它们三个之间可以相互倒可乐 (都是没有刻度的,且 S==N+M,101>S>0,N>

2016-11-24 15:28:03 373

原创 CF--Technocup 2017 - Elimination Round 2(ABCDE)

真的不是模拟专场么?(大雾A题:题意:遇到ogo换成*** 后面紧接着的所有go忽略,其他字符打印出来tip:while大法好#include <cstdio>#include <iostream>#include <cstring>using namespace std;const int maxn = 110;int n;char s[maxn];void init(){

2016-11-22 21:29:23 537

原创 [kuangbin带你飞]专题一 简单搜索L

A题,B题,C题这三道题实在是没什么说的QAQ, A:#include <cstdio>#include <iostream>#include <cstring>#define maxn 10using namespace std;int m,n,ans;char s[maxn][maxn];bool cal[maxn];void init(){ ans= 0 ;

2016-11-22 12:59:16 711

原创 [kuangbin带你飞]专题一 简单搜索 K

http://poj.org/problem?id=3984少了一篇题解强迫症会不开心。。。 10min写完1A的题说什么?#include <cstdio>#include <iostream>#include <cstring>#include <queue>using namespace std;const int maxn = 10;typedef pair<int,int>p

2016-11-20 01:27:51 534 1

原创 [kuangbin带你飞]专题一 简单搜索 J

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2671 Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the m

2016-11-19 18:49:15 764

原创 [kuangbin带你飞]专题一 简单搜索 I

Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and the

2016-11-19 10:34:16 562 1

原创 kuangbin带你飞]专题一 简单搜索 H

http://poj.org/problem?id=3414 You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: 1 FILL(i) fill the pot i (1 ≤ i ≤ 2) from th

2016-11-18 17:49:00 347

原创 [kuangbin带你飞]专题一 简单搜索 G

Description A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker chips, S1 and S2, each stack containing

2016-11-18 17:43:54 530

原创 [kuangbin带你飞]专题一 简单搜索 F

The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a matter of se

2016-11-18 17:33:04 365

原创 [kuangbin带你飞]专题一 简单搜索 E

Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 2

2016-11-18 17:13:59 559

原创 [kuangbin带你飞]专题一 简单搜索 D

Description Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an M × N grid (1 ≤ M ≤ 15

2016-11-18 16:55:17 669

原创 [kuangbin带你飞]专题一 简单搜索C

Description Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0

2016-11-18 16:36:01 298

原创 [kuangbin带你飞]专题一 简单搜索B

Description You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit

2016-11-18 16:13:50 364

原创 [kuangbin带你飞]专题一 简单搜索 A

Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8

2016-11-18 16:09:09 336

原创 最长回文子串(O(n) )Manacher算法

http://www.spoj.com/problems/MSUBSTR/ As we all know Utkarsh is very good at solving number based problems, this time Arpit thinks smartly and gives Utkarsh to solve a problem on Strings. Arpit gives

2016-10-10 01:59:48 463

原创 vijos kmp next数组应用

https://vijos.org/p/1677背景 陶陶是一个智能机器人,他能像人一样思考问题,不过由于IQ问题,他给自己取了一个很长很长的名字。 描述 某一天,陶陶想把自己的名字涂在墙上。由于他的名字太长,为了省事,他从自己名字的开头截取了一段作为模板。我们不妨设这个模板的长度为l,陶陶的名字的长度为L,那么有1≤l≤L。然后陶陶会用这个模板进行若干次喷涂,喷出自己的名字(后一次喷涂会覆盖

2016-10-10 01:18:55 499

原创 hiho#1015 : KMP算法

http://hihocoder.com/problemset/problem/1015 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程的学习道路上一同前进。这一天,他们遇到了一只河蟹,于是河蟹就向小Hi和小Ho提出了那个经典的问题:“小Hi和小Ho,你们能不能

2016-10-10 00:38:58 298

原创 n个数中任意两个异或最大值

01字典树 把每一个数以二进制形式从高位到低位插入trie中,依次枚举每个数,在trie中贪心,即当前为0则向1走,为1则向0走。#include <stdio.h>#include <string.h>#define MAX(a,b) ((a)>(b)?(a):(b))#define NODE 3200010#define N 100010int n;int v[N];int no

2016-10-01 11:55:37 5492

原创 #poj2699 The Maximum Number of Strong Kings

http://poj.org/problem?id=2699题意:有n(n<=10)个竞赛者,进行了n*(n-1)/2次的比赛。已知每一个竞赛者在比赛中胜利的次数a1、a2、a3……..an。(次序列是从小到大排序的),问你这n个人中最强的竞赛者最多有几个。(如果这个竞赛者胜利的次数最多或这个竞赛者打败了所有胜利次数比他多的竞赛者,那么这个竞赛者就是最强的。其中每两个人有且仅进行一场比赛。)思路:k

2016-09-29 00:54:26 286

原创 poj1149 pigs

http://poj.org/problem?id=1149大意:有 M 个猪圈,每个猪圈里初始时有若干头猪。一开始所有猪圈都是关闭的。依 次来了 N 个顾客,每个顾客分别会打开指定的几个猪圈,从中买若干头猪。每 个顾客分别都有他能够买的数量的上限。每个顾客走后,他打开的那些猪圈中的 猪,都可以被任意地调换到其它开着的猪圈里,然后所有猪圈重新关上。问总共 最多能卖出多少头猪。(1 <= N <= 1

2016-09-28 03:08:01 368

原创 poj2391Ombrophobic Bovines

Floyd+二分+最大流(dinic)+拆点 貌似这样子显得很高端呢传送门大意:给定一个无向图,点 i 处有 Ai 头牛,点 i 处的牛棚能容纳 Bi 头牛,求一个最短时 间 T 使得在 T 时间内所有的牛都能进到某一牛棚里去。(1 <= N <= 200, 1 <= M <= 1500, 0 <= Ai <= 1000, 0 <= Bi <= 1000, 1 <= Dij <= 1,000,00

2016-09-28 02:42:24 348

原创 简单dp

http://www.lydsy.com/JudgeOnline/problem.php?id=1037 #include <cstdio>#include <iostream>#include <cstring>#define maxn 160using namespace std;long long n,m,k,dp[maxn][maxn][25][25],ans;//i个男的j个

2016-09-02 20:49:14 259

原创 陕西省集训之树状数组

http://acm.hust.edu.cn/vjudge/contest/127376#overview 终于写到树状数组了啊,好开心 树状数组可以满足两种题型:1是单点询问区间修改,另一个是区间询问单点修改int lowbit(int x){ return x&(-x);}void add(int pos,int num){ for(int i = pos ; i <

2016-09-01 18:43:17 623

原创 陕西省集训(单调队列)

A题:题意:对于一个序列A[1…N],一共N个数,除去M个数使剩下的数组成的整数最小。 也就是说在A[1…N]中顺次选取N-M个数,使值最小。思路:单调队列,删除少于要求各节点的话比之前的数字小,就一定把之前的删除,让小的这个做第一个,这样就相当于维护一个单挑队列,先满足前面的尽量小,能删多少删多少#include <iostream>#include <cstdio>#include <cs

2016-09-01 15:56:33 317

原创 陕西省集训(并查集)

并查集正常的思想就是每次输入的时候找到两个人的祖先,如果不是一个的话,把随便一个并给另一个,然后最后想知道有多少个不联营的区域就是相当于找多少个爸爸是自己的节点; int findroot(int i) { if(fa[i] == i) return i; return fa[i] = findroot(fa[i]);

2016-09-01 14:23:14 298

原创 陕西省集训之树形dp

doc老师给的树形dp的建议是一次dfs出来所有的解,而不是用记忆化搜索,每次都去dfs子解然后看是否算过了A题: http://poj.org/problem?id=2342There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has

2016-09-01 13:20:30 351

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除