nxt creations

Read about nxt creations, The latest news, videos, and discussion topics about nxt creations from alibabacloud.com

Bzoj 1412 The story of the Wolf and the Sheep

This is the minimum cut, but I think for a long time ....Consider all sheep connected to the source point, the wolf connected to the meeting point, adjacent points on both sides of the minimum cut (maximum flow) can be.Correctness? Considering something like a dichotomy, we just need to set the wolf together and waist the sheep.#include #include #include #include #define Maxe 100005#define MAXV 10011#define INF 1234567#define S 0#define T 10010using namespace Std;int n,m,map[105][105],dx[]={0,0,

POJ2778 DNA Sequence

The main problem: give the M disease gene fragment (mAnalysis: The subject needs to build an AC automaton for the gene fragments of M disease, and each node in the automaton represents a state. The leaf nodes in the AC automata represent viruses, so they are illegal. At the same time, if a node to the root of the string suffix is a virus, then the node is also an illegal state. Eliminate all illegal state, then the rest of the nodes are in the legal state. The node's

Network stream (Max Stream): POJ 1149 PIGS

. Input the first line ofinput(Input)Containsintegers(integer)M and N, 1 The next line contains M Integeres, for each pig-house initial number of pigs. The number of pigs in pig-house are greater or equal to 0 and less or equal to 1000.The next N lines contains records about the customers in the following form (record on the i-th customer is written in The (i+2)-th line):A K1 K2 ... Ka B It means that this customer have key to the pig-houses marked with the numbers K1, K2, ..., Ka (sortednondecr

Bzoj 3275 Number

Minimum cut.Network flow don't write wrong.#include #include #include #include #include #define MAXN 5050#define MAXV 20050#define Maxe 400050#define INF 1000000007using namespace Std;int N,A[MAXN],NUME=1,G[MAXV],S,T,DIS[MAXV];Queue struct Edge{int v,f,nxt;}e[maxe];void Addedge (int u,int v,int f){E[++nume].v=v;E[nume].f=f;E[nume].nxt=g[u];G[u]=nume;E[++nume].v=u;e[nume].f=0;E[NUME].

Bzoj 1066 Lizard

Network flow.Map: First split each pillar into two points.The in point of each pillar points outward to an edge with a capacity of column height.The out point of each pillar is connected to the point at which a column can be reached, and a capacity is a positive infinity edge.The point of Origin is connected to one edge of each column that has an initial lizard.Each pillar that jumps out of the map will have a positive infinity edge to the sink point.Running the maximum flow is the number of liz

Codevs1364 Treasure Hunt

http://codevs.cn/problem/1364/ SolvingA look is a short-circuit problem. Set the starting point, end point, press test instructions to add edge. Each floor is annular, the end of the n+1 layer, add edge should be extra careful. A bit of a layered graph. Heap optimization Dijkstra patience to write down. The shortest way to test, but also to test patience. Code #include #include #include #include using namespace STD;Const intOO =1000000000, nil =0;intNmMap[ $][ $];structp

BZOJ 1497 Maximum profit

From NOI2006, this is probably the first network stream in history.Remember how to build a maximum-weight closed sub-graph. Also remember that the network flow of the number of sides and points must not be easily determined!#include #include #include #include #include #define MAXV 55500#define Maxe 1000005#define INF 0X7FFFFFFFusing namespace Std;struct Edge{int v,f,nxt;}e[maxe];int nume=1,n,m,x,y,z;int G[MAXV],S=0,T,SUM=0,MAXCUT=0,DIS[MAXV];inline vo

Coj 0349 Wzj's Travels (Fri)

" ...) ), then the problem becomes super piano ....1#include 2#include 3#include 4#include 5#include 6#include 7 #definePAU Putchar (")8 #defineENT Putchar (' \ n ')9 #defineCH for (int d=0;dTen #defineLson x->ch[0],l,m One #defineRson X->ch[1],m+1,r A using namespacestd; - Const intmaxn=500000+Ten, maxnode=3000000+Ten, maxm=1000000+Ten, maxt=maxn* -, inf=-1u>>1; - structted{intX,Y,W;TED*NXT;} adj[maxm],*fch[maxn],*ms=adj; the voidAddintXintYintW) { -

hdu1588---Gauss Fibonacci (Matrix, linear recursion)

, D; Martix:: Martix () {memset(Mat,0,sizeof(MAT));} Martix Martix::operator* (ConstMartix b)Const{Martix ret; for(inti =0; I 2; ++i) { for(intj =0; J 2; ++J) { for(intK =0; K 2; ++K) {Ret.mat[i][j] + = ThisMAT[I][K] * B.mat[k][j]; RET.MAT[I][J]%= mod; } } }returnRET;} Martix Martix::operator+ (ConstMartix b)Const{Martix ret; for(inti =0; I 2; ++i) { for(intj =0; J 2; ++J) {Ret.mat[i][j] = ThisMAT[I][J] + b.mat[i][j]; RET.MAT[I][J]%= mod; } }returnRET;} martix Mart

"Template" Tree chain split

How to use: sz (size) storage subtree size DP (deep) storage node depth fa (father) storage node Father HS (heavy son) storage node heavy son HF stores the top node of the current node's chain ID Storage node number nd (node) stores the current number Corresponding node Namespace Tree {#define MAXN 100001int SZ[MAXN], DP[MAXN], fa[maxn];int hs[maxn] = {0};void DFS1 (int x, int f, int dep) {D P[X] = DEP, fa[x] =

Hoj 2713 Matrix1

some 22 nonadjacent lattice, so that the weight of the largest ...Analysis:The most power value independent set problem, the grid diagram, so can black and white dyeing, s to Black point a capacity for the lattice weight of the edge, white point to t even a capacity for the lattice weight of the edge, the black point to the adjacent white point with a capacity of +∞ edge, and then the smallest cut is the minimum point weight coverage, The total weight minus the minimum cut is the answer ...Code

Codeforces Round #225 (Div. 2)---E. propagating tree (timestamp + line segment)

son to add that number, so we will be based on the depth of the odd couple, the time stamp into 2 arrays, the establishment of 2 segment tree/************************************************************************* > File name:cf225-e.cpp > Auth Or:alex > Mail: [email protected] > Created time:2015 April 21 Tuesday 21:11 04 seconds ******************************** ****************************************/#include #include #include #include #include #include #include #include #include #include

Recent public ancestor LCA Tarjan algorithm

How far away?This problem test instructions is, given a tree, each side has a certain weight, q times asked, each time asked about the distance between two points. So you can use LCA to solve, first find the U, v two point of the LCA, and then calculate the distance value on it. Here the calculation method is, note the root node to any point of distance dis[], so that ans = dis[u] + dis[v]-2 * DIS[LCA (V, v)], this expression is relatively easy to understand://==================================

So he started the wrong roll Call (Trie tree)

format:For each coach's name, output one line. If the name is correct and is first appeared, output "OK", if the name is wrong, output "wrong", if the name is correct but not first appear, output "REPEAT". (all without quotation marks)Ideas:It is said that the hash can be past, but I still obediently wrote the trie treeWe've built everyone's name into a trie tree.And then run a match.If there are no nodes on the trie and there are no matches, then the point is wrong.If the point to the name is

2016 Shenyang online race barricade

with three integersu,v andWwhere0≤w≤ Denoting an edge between u and v of Barricade cost w. Outputfor Each test cases, the output of the minimum wood cost. Sample Input14 2 4 1 3 4 Sample Output4Analysis: The shortest cut maximum flow can be obtained;Code:#include #include#include#include#include#include#include#includestring>#includeSet>#include#include#include#include#include#defineRep (I,m,n) for (i=m;i#defineRSP (It,s) for (Set#defineMoD 1000000007#defineINF 0x3f3f3f3f#defineVI vector

PKU 2406 & PKU 1961 period & hdu3746 cyclic nackiod

Hey hey, I wrote it before. I just suddenly saw it, so I posted it. KMP is used to search for the next [] array and the longest repeated string. Pku2406 # Include PKU 1961 # Include HDU 3746 cyclic nacklace View code # Include # Include Using Namespace STD; Const Int N = 100000 + 10 ; Char P [N]; Int NXT [N], M; Void Get_next () {NXT [ 0 ] =- 1 ; Int K =- 1 ; For ( Int I =

Bzoj 2127:happiness

with revenue, each augmented path is actually the minimum traffic on the augmented roadso it's not the biggest payoffto run min cutans= Ownership Value and-min cutExplanation: Step 2: If you cut the same selection of this side, then the two students can only cut the edge of the text, otherwise it will be through the INF edge with the meeting point, does not meet the minimum cut#include #include#include#defineN 50101#defineM n*30#defineINF 2e9using namespacestd;intfront[n],to[m],

Hdu 5438 Ponds Topological ordering

, where VI (1≤VI≤108) indicating the value of Pond I.Each of the last m lines contain-numbers A and B, which indicates that pond A and pond B is connected by a pipe.OutputFor each test case, output the sum of the value of all connected components consisting of odd number of ponds after removi Ng all the ponds connected and less than the pipes.Sample Input17 71 2 3 4 5 6 71 41 54 52 32 63 62 7Sample Output21HINTTest instructionsGive you a picture, and then ask for the number of points less than 2

POJ2376 Cleaning Shifts

is mx[], farthest right end position One intans=0; A intMain () { -scanf"%d%d",n,t); - intb; the inti,j; - for(i=1; i){ -scanf"%d%d",a,b); -mx[a]=Max (mx[a],b); + } - intlast=1, now=1; + intEd; A while(nowt) {//now is the length that is currently covered atEd=0; - for(i=last;i){ - if(mx[i]>ed) { -ed=mx[i];last=i; - } - } in if(ed+1==Now ) { -printf"-1\n"); to return 0; + } -Now=ed+1; ans++; the

Bzoj 1565: [NOI2009] Plants vs Zombies

sample ... TAT ... Because there are rings ...So we have to delete the point of the ring, and if the point on the ring is not selectable, then the point pointing at it cannot be selected ... What to do? Topological sort?But the topological sort can only judge if there is no ring, cannot judge whether the point is on the ring ... For example, the following picture ...But it's a coincidence that our chart is that all points pointing to the ring are not selectable ... So reverse all sides ... Topo

Total Pages: 15 1 .... 8 9 10 11 12 .... 15 Go to: Go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.