nxt creations

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

Bzoj 1305 Dance Dance

multiple boys, the final maximum flow will be reduced.#include #include#include#include#includeusing namespacestd;Const intdian=305;Const intbian=40005;Const intinf=0x3f3f3f3f;intN,k,tot;ints,t;intH[dian],nxt[bian],ver[bian],val[bian],ch[dian];Charmap[ -][ -];voidAddintCanintBbintcc) {Tot++;ver[tot]=bb;val[tot]=cc;nxt[tot]=h[aa];h[aa]=tot; Tot++;ver[tot]=aa;val[tot]=0;

"Codevs 1993" Lawn Drainage isap template problem

Gao Tianyu's Isap template, don't explain it ...#include #include#include#include#includeusing namespacestd;Const intinf=1E9;intn,m,point[203],nxt[403],v[403],c[403],cnt=0;intdeep[203],num[203],cur[203],lastedge[203];BOOLvis[203];inlineintGetint () {CharC while(!isdigit (C=getchar ()));inta=c-'0'; while(IsDigit (C=getchar ())) a=a*Ten+c-'0';returnA;} InlinevoidInsect (intXintYintZ) {nxt[cnt]=point[x];p oint

Bzoj 1797: [Ahoi2009]mincut min cut

A Const intmaxn=4000+5, maxm=60000*2+5; - - intn,m,s,t,cnt,id[maxm],hd[maxn],to[maxm],fl[maxm],nxt[maxm],vis[maxn],pos[maxn],flag[maxm],ans1[maxm],ans2[ MAXM]; the - intC,TIM,TAIL,MP[MAXN],DFN[MAXN],LOW[MAXN],STK[MAXN],INSTK[MAXN]; - -InlinevoidAddintSintXintYintl) { +fl[cnt]=s;id[cnt]=l;to[cnt]=y;nxt[cnt]=hd[x];flag[cnt]=1; hd[x]=cnt++; -fl[cnt]=0; id[cnt]=m;to[cnt]=x;

Bzoj 2750 Road

Shortest way +DP.#include #include#include#include#include#defineMAXV 1550#defineMaxe 10050#defineINF 0x7f7f7f7f#defineMoD 1000000000using namespacestd;structedge{Long Longv,w,nxt,cnt;} E[maxe];Long LongN,m,x,y,z,nume=0, G[MAXV],A[MAXV],B[MAXV],DIS[MAXV],CNT[MAXV];BOOLVis[maxv];queueLong Long>Q;voidAddedge (Long LongULong LongVLong LongW) {e[++nume].v=v; E[NUME].W=W; E[nume].cnt=0; E[NUME].NXT=G[u]; G[u]=Nu

Hdu_5314_happy King (Point division of the tree)

Title Link: Hdu_5314_happy KingTest instructionsGive a tree of n nodes, point the right value;Find the difference between the maximum and minimum values for a pair (x, y) that satisfies x!=y and x to Y paths ExercisesOr the point of the tree, in the statistical answer to the root of the first order of the minimum value, and then use the maximum value minus D to find how many meet the answer.1#include 2 #defineF (I,A,B) for (int i=a;i3 using namespacestd;4typedef pairint,int>P;5typedefLong Longll

Kuangbin Topic 16H (Next array)

){ Onememset (NXT,0,sizeof(NXT)); A inti =0, j =-1; -nxt[0] = -1; - while(I Len) { the if(j = =-1|| Str[i] = = Str[j]) Nxt[++i] = + +J; - Elsej =Nxt[j]; - } - } + - intMainvoid){ + while(~SCANF ("%s", str)) { ALen =strlen (str); at

"Tarjan topology sort DP" bzoj1093: [ZJOI2007] Maximum semi-connected sub-graph

longest chain with the point right to the graph.Number of programmesIt is easy to find the longest chain in a DAG, either with a memory search or a topological sort. The number of solutions, that is, similar to the DP method, using $g[i]$ to express the longest chain of $i$ as the end of the program number, transfer is also very convenient.Yes, in order to count the number of scenarios, the connecting edges between the blocks need to be weighed.From the Huang blog to learn a very clever way to

[Leetcode] 460. LFU cache Most infrequently used page substitution buffers

LF, key, value): "" "increments the freq of an existing Keynode Python: Class Cachenode (object): Def __init__ (self, key, value, Freq_node, Pre, NXT): Self.key = key Self.value = Value Self.freq_node = Freq_node Self.pre = Pre # previous Cachenode self.nxt = nxt # next Cachenode def free_myself (self): if Self.freq_node.cache_head = = SELF.FREQ_NODE.CACHE_TAIL:SELF.FREQ_NODE.CAC He_

POJ 2449 remmarguts ' Date (k-Short && * algorithm)

Test Instructions: give a direction graph, the beginning S to the end of the T-K short, the absence of the output-1#include #includestring.h>#include#includeusing namespacestd;Const intINF =0x3f3f3f3f;Const intMAXN =1024x768;Const intMAXM =100008;structedge{intV, NXT, W;};structnode{intPos, cost, F; BOOL operatorConstNODE RHS)Const{//pay attention to symbols when overloaded if( This->f = = RHS. Freturn This->cost >RHS. cost; return T

HDU 3861 The King ' s problem

Test instructions: Give us a diagram, ask us to at least divide this graph into parts, so that any two points within each part can be guaranteed at least one-way connectivity.Idea: Use the Tarjan algorithm to find strong connected components and then to shrink points, to form a new map, easy to know the new map of each point inside the internal points can be guaranteed bidirectional connectivity, and the new map points are one-way non-ring, this time the topic requirements of the Division of the

Bzoj 2160: Cheerleading Rehearsal

Title: http://www.lydsy.com/JudgeOnline/problem.php?id=2160After the construction of the palindrome tree, from the back to sweep again, so that cnt[fail[i]]+=cnt[i], you can get the number of occurrences of each string. Then for a palindrome tree in a node, its length is len[i], the number of occurrences of cnt[i], then we take out the first K-length of the odd string multiplication on it. Fast power.#include #include#include#include#defineRep (i,l,r) for (int i=l;i#defineDown (i,l,r) for (int i

Hdu-5421victor and String

Title: http://acm.hdu.edu.cn/showproblem.php?pid=5421Because to be in front of the character, so maintain a prefix chain and suffix chain, on the same palindrome tree, if there is a longest palindrome suffix (or prefix) length of the total, then let the prefix (or suffix) of the last also assigned to the current node.#include #include#include#include#defineRep (i,l,r) for (int i=l;i#defineDown (i,l,r) for (int i=l;i>=r;i--)#defineCLR (x, y) memset (x,y,sizeof (×))#definell Long Long#defineMAXN 2

Bzoj 2229 min. cut

Who would set the INF to 0x3f like me?GH Tree.#include #include#include#include#include#defineMAXV 250#defineMaxe 50050#defineINF 0x7fffffffusing namespacestd;structedge{intV,F,NXT;} E[maxe];intt,a,b,c,qq;intN,M,MAP[MAXV][MAXV],F[MAXV][MAXV],S,T,NUME,G[MAXV];intRegis[maxv*maxv],cnt=0;intDis[maxv],fath[maxv],rrr=0;BOOLVis[maxv];queueint>Q;voidReset () { for(intI=1; i) for(intj=1; j) {Map[i][j]=0; F[I][J]=inf; }}voidAddedge (intUintVintW) {e[++n

ZOJ 3795:grouping (indent + longest)

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5303Test instructions: There are n person M edge, each side has a u,v, the age of the U is greater than or equal to V, now to divide the n person into x groups, the age of the group can not be directly or indirectly compared, ask at least how many groups can be divided.Idea: At first did not see test instructions, the direct topological sort did. Later listen to brother said there will be a ring, age is equal to, if there is a ring repre

SPOJ 371 Boxes

n boxes in a circle, the first box I have an AI ball, each time you can move a ball from a box into one of the two adjacent boxes. Ask how many times to move so that the number of balls in each box does not exceed 1.σaiMinimum cost maximum flow.Each box as a point.If the ai>1 is connected to this point from the source point to a capacity of AI, the cost is 0 side.If the ai=0 is from this point to the meeting point a capacity of 1, the cost of 0 side.Each box is connected to the adjacent two boxe

POJ 3680 Intervals

corresponding problem (AI,BI) The point of the remaining number of coverage minus one. It is noted that the interval of the subject is open, so the two-interval connection does not affect the result.1#include 2#include 3#include 4#include 5#include 6 using namespacestd;7 Const intdian=405;8 Const intbian=1505;9 Const intinf=0x3f3f3f3f;Ten intZkh[dian],ykh[dian],khqz[dian]; One intZl[dian],yl[dian]; A intH[dian],nxt[bian],ver[bian],val[bian],cos[bian]

Ural1519 Formula 1 (plug DP)

Original title URL: http://acm.timus.ru/problem.aspx?space=1num=1519For plug DP and state compression please refer to:Http://wenku.baidu.com/link?url=AFuYe_ Efr5yxmnk0ry-tale6llgkhsovxbm1rqulxelprvjqvlo724nuxlxtadx4alp7fhiz8aexyity06_r4cv5xus6c9lm5vpz5kdr6hgDetailed code (c + +):1#include 2#include 3#include 4 //using namespace std;5 6typedefLong LongLL;7 Const intMAXRC = the, maxstate=300001;8 intm,n,er=-1, EC, idx=0;9 intcity[maxrc][maxrc]={0}, BITS_AT[MAXRC];//1 is valid.Ten One classhashmap

HDU 4292:food (maximum flow)

http://acm.hdu.edu.cn/showproblem.php?pid=4292Test instructions: It's almost like a cow, but there are a variety of foods.Idea: Because of the variety of food, so the source and meeting point capacity to be changed. and Dinic and Tle, with ISAP.#include #include#include#include#includestring>#include#include#include#include#includeSet>using namespacestd;#defineINF 0x3f3f3f3f#defineN 910typedefLong LongLl;typedefLong LongLL;structEdge {intV, Cap, NXT;

Codevs 1218 Outbreak control

Ah good to bother with this problem ....Basic ideas are available online.One thing to note is that if the source of the army is not matched at the time of the match, then the source is matched first. (for no cost).But the data good water ....#include #include#include#include#defineMAXV 50050#defineMaxe 100500using namespacestd;intN,x,y,z,g[maxv],nume=0, m,c[maxv],anc[maxv][ -],dis[maxv][ -],l=1, r=0, disr[maxv],kr=0, FATH[MAXV];inttop=0, cnt=0;BOOLVIS[MAXV],RET[MAXV];structedge{intV,W,

Uvalive 2147push!! (Queue implementation DP)

; for(inti =0; I 4; i++) {xx1= x1 + go[i][0]; Yy1= y1 + go[i][1]; if(OK (xx1,yy1)) {if(xx1 = = x2 yy1 = =y2) {xx2= x2 + go[i][0]; Yy2= y2 + go[i][1]; if(OK (xx2,yy2)) {if(dp[xx1][yy1][xx2][yy2]==-1|| dp[xx1][yy1][xx2][yy2]>dp[x1][y1][x2][y2]+1)/// First level inspection {Dp[xx1][yy1][xx2][yy2]= dp[x1][y1][x2][y2]+1;/// update current point statusif(!Vis[xx1][yy1][xx2][yy2]) {Node NXT (xx1,yy1,xx2,yy2);

Total Pages: 15 1 .... 5 6 7 8 9 .... 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.