自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

vocaloid01的博客

菜鸡的笔记本~

  • 博客(64)
  • 收藏
  • 关注

原创 POJ - 2449 Remmarguts' Date(A*+SPFA求第K短路)

"Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he told them a story."Prince Remmarguts lives in his kingdom UDF – U...

2018-07-30 21:50:34 206

原创 2018暑期HDU多校第三场—— L Visual Cube

Problem DescriptionLittle Q likes solving math problems very much. Unluckily, however, he does not have good spatial ability. Everytime he meets a 3D geometry problem, he will struggle to draw a pic...

2018-07-30 19:31:44 204

原创 无向图求欧拉路径,回路 模板(Hierholzer 算法)

定义:欧拉回路:每条边恰好只走一次,并能回到出发点的路径欧拉路径:经过每一条边一次,但是不要求回到起始点欧拉回路存在性的判定:无向图每个顶点的度数都是偶数,则存在欧拉回路。有向图每个节顶点的入度都等于出度,则存在欧拉回路。欧拉路径存在性的判定:有向图 : 图连通,当且仅当该图所有顶点数的度数为0,或者一个顶点的度数为1,另一个顶点的度数为-1,其他顶点的度数为0。...

2018-07-29 18:43:56 4966

原创 二维树状数组模板(单点更新,区间求和)

const int MAXN = 1050;int N;int tree[MAXN][MAXN];int lowbit(int x){ return x&(-x);}void Add(int x,int y,int val){ for (int i=x ; i<=N ; i+=lowbit(i)) ...

2018-07-29 11:39:43 260

原创 POJ - 1195 Mobile phones (二维树状数组求区间和)

Suppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares form an S * S matrix with the rows and columns numbe...

2018-07-29 10:21:15 177

原创 POJ - 2155 Matrix (二维树状数组入门)

Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 <= i, j <= N).We can change the matrix in the...

2018-07-28 19:38:14 117

原创 巧得int(4字节)最大最小值

方法一:自力更生#include <bits/stdc++.h>using namespace std;int main(){ unsigned int a = 0; int MAX_int = (~a)/2; cout<<MAX_int<<endl; return 0;} 可以得到int最大值为2147483647,而根据常...

2018-07-27 20:30:23 12057

原创 POJ - 1860 Currency Exchange (Spfa判断是否有正权环)

Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies. There can...

2018-07-27 18:12:06 207

原创 POJ - 3169 Layout(差分约束入门题)

Like everyone else, cows like to stand close to their friends when queuing for feed. FJ has N (2 <= N <= 1,000) cows numbered 1..N standing along a straight line waiting for feed. The cows are s...

2018-07-27 15:04:07 186

原创 2018牛客暑期多校训练第三场——C Shuffle Cards(rope大法)

时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288KSpecial Judge, 64bit IO Format: %lld题目描述Eddy likes to play cards game since there are always lots of randomness in the game. For most of the car...

2018-07-27 12:16:36 198

原创 Rope大法(可持久化平衡树)

2008年OI集训论文上有介绍<对块状链表的一点研究>,其主要是结合了链表和数组各自的优点,链表中的节点指向每个数据块,即数组,并且记录数据的个数,然后分块查找和插入。头文件:#include <ext/rope>命名空间:using namespace __gnu_cxx基本操作:rope test;test.push_back(x);//在末尾添...

2018-07-27 10:34:05 1541 1

原创 常用数论知识总结(持续更新)

皮克定理: 皮克定理是一个计算点阵中顶点在格点上的多边形面积公式,该公式可以表示为2S=2a+b-2,其中a表示多边形内部的点数,b表示多边形边界上的点数,S表示多边形的面积。无名定理(分数小数互化,判断是否是有限小数或无限循环小数):一个分数如果它的分母是10^n(n是含零自然数),就可以直接写成整数或有限小数;而一个有限小数化成分数,第一步就是将其分母写成10^n。如果一个分数无法将其分母...

2018-07-24 21:04:09 738

原创 计蒜客 035 三角形内点的个数(皮克定理)

1000ms 65536K在一个平面坐标系中,我们可以选出三个不全在一条线上的点构成一个三角形。我们称一个在三角形内(不包含三角形的边上),横纵坐标皆为整数的点位这个三角形的内点。 对于一个由(0,0)、(n,m)、(p,0)作为顶点构成的三角形,请你设计程序求出他的内点数。输入包括一行,包括三个用空格分隔的整数,分别为n,m,p(0 ≤ n < 32000,0 < m &lt...

2018-07-24 21:01:47 648

原创 Spfa模板

const int MAXN =1e3+10;const int INF = 0x3f3f3f3f;int mapp[MAXN][MAXN];int dis[MAXN];bool mark[MAXN];int num[MAXN];//用于检测负权环 int N;//点的数量 int Spfa(int from){ memset(mark,0,sizeof mark); m...

2018-07-24 15:32:02 167

原创 HDU-6299 Balanced Sequence(2018-HDU多校-第一场-02)

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1695    Accepted Submission(s): 418Problem DescriptionChiaki has n strings s1,s2,…,sn consi...

2018-07-24 11:35:14 361

原创 字符串连接(贪心)

输入n个字符串s[i],你要把他们按某个顺序连接起来,使得字典序最小。(1 <= n <= 100) (每个字符串长度 <= 100) (字符串只包含小写字母)Input 第一行一个整数n。 接下来每行一个字符串s[i]。 Output一行一个字符串表示把输入的n个字符串按某个顺序连接之后的结果Input示例6itlookslike...

2018-07-24 10:28:27 289

原创 牛客小白月赛5——D 阶乘

时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K题目描述输入描述:输入数据共一行,一个正整数n,意义如“问题描述”。输出描述:输出一行描述答案:一个正整数k,表示S的末尾有k个0示例1输入10输出7说明题解:难以描述,代码也不长直接看代码应该就懂了。代码:#i...

2018-07-23 10:33:35 251

原创 牛客小白月赛5——I 区间(前缀和)

 题目描述    Apojacsleam喜欢数组。    他现在有一个n个元素的数组a,而他要对a[L]-a[R]进行M次操作:        操作一:将a[L]-a[R]内的元素都加上P        操作二:将a[L]-a[R]内的元素都减去P    最后询问a[l]-a[r]内的元素之和?    请认真看题干及输入描述。输入描述:输入共M+3行:第一...

2018-07-23 10:15:23 322

原创 HDU - 5918 Sequence I(2016年长春区域赛铜牌题)

Mr. Frog has two sequences a1,a2,⋯,an and b1,b2,⋯,bm and a number p. He wants to know the number of positions q such that sequence b1,b2,⋯,bm is exactly the sequence aq,aq+p,aq+2p,⋯,aq+(m−1)p where q+...

2018-07-22 15:09:58 212

原创 51NOD贪心教程(任务执行顺序典型题+详细解析)

有N个任务需要执行,第i个任务计算时占R[i]个空间,而后会释放一部分,最后储存计算结果需要占据O[i]个空间(O[i] < R[i])。例如:执行需要5个空间,最后储存需要2个空间。给出N个任务执行和存储所需的空间,问执行所有任务最少需要多少空间。分析: 本题可以抽象成,从一个整数开始,每次减去a,再加上b (a,b都是正数),要求每次操作都不产生负数。针对本题a[i] ...

2018-07-22 10:39:56 256

原创 51NOD贪心教程(活动安排典型题+详细解析)

一:有若干个活动,第i个开始时间和结束时间是[Si,fi),只有一个教室,活动之间不能交叠,求最多安排多少个活动?分析: 我们就是想提高教室地利用率,尽可能多地安排活动。考虑容易想到的几种贪心策略:(1) 开始最早的活动优先,目标是想尽早结束活动,让出教室。然而, 这个显然不行,因为最早的活动可能很长,影响我们进行后面的活动。例如活动开始和结束时间分别为[0, 100), [1,2...

2018-07-22 10:09:12 447

原创 money(牛客网暑期ACM多校训练营第二场-D题)

时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 131072K,其他语言262144K64bit IO Format: %lld题目描述White Cloud has built n stores numbered from 1 to n.White Rabbit wants to visit these stores in the order from 1 to n....

2018-07-21 17:08:03 247

原创 HDU 5982 Relic Discovery (2016年青岛区域赛A题——水题)

Recently, paleoanthropologists have found historical remains on an island in the Atlantic Ocean. The most inspiring thing is that they excavated in a magnificent cave and found that it was a huge tomb...

2018-07-20 20:42:58 426

原创 主席树求区间第K小(大)数模板

#include <cstdio>#include <algorithm>using namespace std;const int MAXN = 1e5+10;struct T{ int L,R;//分别指向左右子树 int sum;//该节点所管辖区间范围内数的个数 T(){ sum = 0; }}Tree[MAXN*20];//尽量开大点...

2018-07-20 19:04:27 399

原创 HDU - 2665 Kth number (主席树求区间第K小数模板题)

Give you a sequence and ask you the kth big number of a inteval.InputThe first line is the number of the test cases.For each test case, the first line contain two integer n and m (n, m <= 1000...

2018-07-20 18:56:07 150

原创 HDU - 2160 母猪的故事 (休闲思维题,预防脑袋老化)

话说现在猪肉价格这么贵,著名的ACBoy 0068 也开始了养猪生活。说来也奇怪,他养的猪一出生第二天开始就能每天中午生一只小猪,而且生下来的竟然都是母猪。不过光生小猪也不行,0068采用了一个很奇特的办法来管理他的养猪场:对于每头刚出生的小猪,在他生下第二头小猪后立马被杀掉,卖到超市里。假设在创业的第一天,0068只买了一头刚出生的小猪,请问,在第N天晚上,0068的养猪场里还存有多少头猪...

2018-07-20 12:33:53 373

原创 51Nod - 1433 0和5

小K手中有n张牌,每张牌上有一个一位数的数,这个字数不是0就是5。小K从这些牌在抽出任意张(不能抽0张),排成一行这样就组成了一个数。使得这个数尽可能大,而且可以被90整除。注意:1.这个数没有前导0,2.小K不需要使用所有的牌。 Input每个测试数据输入共2行。第一行给出一个n,表示n张牌。(1<=n<=1000)第二行给出n个整数a0,a1,a2,...

2018-07-20 11:30:12 94

转载 能被2、3、4、5、6、7、8、9等数整除的数的特征

性质1:如果数a、b都能被c整除,那么它们的和(a+b)或差(a-b)也能被c整除。性质2:几个数相乘,如果其中有一个因数能被某一个数整除,那么它们的积也能被这个数整除。能被2整除的数,个位上的数能被2整除(偶数都能被2整除),那么这个数能被2整除能被3整除的数,各个数位上的数字和能被3整除,那么这个数能被3整除能被4整除的数,个位和十位所组成的两位数能被4整除,那么这个数能被4整...

2018-07-20 11:16:34 1134

原创 POJ - 2060 Taxi Cab Scheme

Running a taxi station is not all that simple. Apart from the obvious demand for a centralised coordination of the cabs in order to pick up the customers calling to get a cab as soon as possible,there...

2018-07-19 11:05:51 152

原创 POJ - 1904 King's Quest (Tarjan+完美匹配)

Once upon a time there lived a king and he had N sons. And there were N beautiful girls in the kingdom and the king knew about each of his sons which of those girls he did like. The sons of the king w...

2018-07-18 10:54:57 169

原创 匈牙利算法模板

const int MAXN = 205;bool board[MAXN][MAXN];//存边 int color[MAXN];//用于染色法判断是否是二分图 int N,M;//N个点M条边 bool Judge(int x){ for(int i=1 ; i<=N ; ++i){ if(board[x][i] == 0)continue; if(color[x]...

2018-07-17 17:26:50 164

原创 HDU - 2444 The Accomodation of Students(二分图判断加匈牙利算法)

There are a group of students. Some of them may know each other, while others don't. For example, A and B know each other, B and C know each other. But this may not imply that A and C know each other....

2018-07-17 17:13:59 152

原创 最大流模板

const int MAXN = ;const int INF = 0x3f3f3f3f; struct Edge{ int flow,to,rev; Edge(){} Edge(int a,int b,int c):to(a),flow(b),rev(c){}}; vector<Edge> E[MAXN]; inline void Add(int from,i...

2018-07-17 16:24:28 182

原创 最小费用最大流模板

const int INF = 0x3f3f3f3f;const int MAXN = ; struct Edge{ int value,flow,to,rev; Edge(){} Edge(int a,int b,int c,int d):to(a),value(b),flow(c),rev(d){}}; vector<Edge> E[MAXN]; inli...

2018-07-17 16:21:16 179

原创 关于最大匹配,最小点覆盖,最少路径覆盖和最大独立集的总结

最小点覆盖:点覆盖的概念定义:对于图G=(V,E)中的一个点覆盖是一个集合S⊆V使得每一条边至少有一个端点在S中。最小点覆盖:就是点覆盖中点的个数最少的集合S。最小边覆盖:边覆盖的概念定义:边覆盖是图的一个边子集,使该图上每一节点都与这个边子集中的一条边关联,只有含孤立点的图没有边覆盖,边覆盖也称为边覆盖集,图G的最小边覆盖就是指边数最少的覆盖,图G的最小边覆盖的边数称为G的边...

2018-07-17 16:07:18 3086

原创 POJ 1422 Air Raid (二分图+有向图最小不相交路径覆盖)

Consider a town where all the streets are one-way and each street leads from one intersection to another. It is also known that starting from an intersection and walking through town's streets you ...

2018-07-17 15:28:47 326

转载 【研究总结】2-sat问题

转载自:https://blog.csdn.net/jarjingx/article/details/8521690序言          最近花了一点心思研究2-sat模型,看了很多论文博客等等,也在POJ上做了一点题。其实这个东西也还挺好玩的,当然,前提是每道题你都有认真分析,认真想清楚模型的意义,搞明白为什么可以这样,而不是简单的知道怎样做,就套上一个模板了事,那样,是不是也太糟...

2018-07-17 15:00:52 955

原创 HDU - 5091 Beam Cannon (线段树+扫描线)

Recently, the γ galaxies broke out Star Wars. Each planet is warring for resources. In the Star Wars, Planet X is under attack by other planets. Now, a large wave of enemy spaceships is approaching. T...

2018-07-17 14:25:45 190

原创 重定向输入输出流

freopen("input.txt","r",stdin);freopen("output.txt","w",stdout); 

2018-07-17 12:12:40 509

原创 HDU - 5094 - 2014上海全国邀请赛 Maze (状压+BFS)

This story happened on the background of Star Trek.Spock, the deputy captain of Starship Enterprise, fell into Klingon’s trick and was held as prisoner on their mother planet Qo’noS.The captain of E...

2018-07-17 10:31:29 179

空空如也

空空如也

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

TA关注的人

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