nxt creations

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

Uvalive 4287 proving equivalence

Using Tarjan to find strong connected components, a DAG is formed after a strong connected component point has an equivalent contraction point, and a number of points a with a degree of 0 are calculated.With a size of 0 B, take one of them. A case in which the number of strongly connected components is 1.It's easier to read the Tarjan algorithm later.#include using namespacestd;Const intMAXN = 2e4+5;Const intMAXM = 5e4+5;inthead[maxn],nxt[maxm],to[max

ICPC Dalian Station Network race 1009 Short Circuit

bfs+ linked ListCode changed from a blog1#include 2#include 3#include 4#include 5#include string.h>6#include string>7#include 8#include Set>9#include Ten#include One using namespacestd; A Const intMAXN = 2e5+5; - Const intINF =0x3f3f3f3f; - Const intA=INF; the Const intb=1; -typedefLong LongLL; - inth[maxn],e; - LL DIS[MAXN]; + BOOLVIS[MAXN]; - intstart; + A structEdge at { - intv,nxt,w; -} e[maxn1]; - - voidInit () - { inE=0; -memset (h,-1,siz

poj1947 Rebuilding Roads

ExercisesTree-shaped dp+ backpackDP[I][J] Indicates that I is the root, preserving the minimum number of edges required to be deleted by J nodesThe default 1 is the root. At the end of the calculation, 1 of the root of the tree should be added 1 (Cut off the Father node)Be aware of initializing .....Code:#include #include#include#includeusing namespacestd;#definePB Push_back#defineMP Make_pair#defineSe Second#defineFS First#defineLL Long Long#defineCLR (x) memset (x,0,sizeof x)#defineMC (x, y) m

Bzoj 1064 "noi2008" masked Ball

=4000100;intN,m,tot,maxn,minn,ansmin,ansmax;intDis[n],head[n],vis[n],ver[m],nxt[m],edge[m];voidAddintUintVintd) {Tot++; Nxt[tot]=Head[u]; Ver[tot]=v; Edge[tot]=D; Head[u]=tot;}intgcdintXinty) { if(!y)returnx; returnGCD (y,x%y);}voidDFS1 (intXintFa//looking for a ring{vis[x]=1; for(intI=head[x];i;i=Nxt[i]) { intv=Ver[i]; if(v!=FA) { if(!vis[v

"Construction problem greedy" cf1041e. Tree reconstruction

#include 2 Const intMAXN =1003;3 4 intN;5 BOOLUSED[MAXN];6 intMP[MAXN][MAXN];7 intedgetot,edges[maxn1],nxt[maxn1],HEAD[MAXN];8 9 intRead ()Ten { One CharCH =GetChar (); A intnum =0; - BOOLFL =0; - for(;!isdigit (CH); ch=GetChar ()) the if(ch=='-') FL =1; - for(; isdigit (CH); ch=GetChar ()) -num = (num1) + (num3) +ch- -; - if(fl) num =-num; + returnnum; - } + voidErrordown () A { atPuts"NO"); -Exit0); - } - voidAd

Bzoj 4390 Max Flow

With the transport plan.#include #include#include#include#defineMAXV 50050#defineMaxe 100500using namespacestd;structedge{intV,NXT;} E[maxe];intn,k,x,y,val[maxv],anc[maxv][ -],ans=0, dis[maxv],g[maxv],nume=0;voidAddedge (intUintv) {e[++nume].v=v; E[NUME].NXT=G[u]; G[u]=Nume;}voidDFS1 (intx) { for(intI=g[x];i;i=e[i].nxt) { intv=e[i].v; if(v!=anc[x][0])

Network Flow maximum Flow template

Topic Links:http://poj.org/problem?id=1273#include #include#include#include#include#include#include#include#include#includestring>#include#defineFi first#defineSe Second#defineINF 0x3f3f3f3f#defineFio Ios::sync_with_stdio (false); Cin.tie (0); Cout.tie (0)#definePqueue priority_queue#defineNEW (b) memset (A,b,sizeof (a))Const DoublePi=4.0*atan (1.0);Const DoubleE=exp (1.0);Const intmaxn=1e4+8; typedefLong Longll;typedef unsignedLong LongULL;ConstLL mod=1e9+7;ConstULLBase=1e7+7;using namespacestd

[Network flow 24 questions] space flight planning problem

=GetChar (); } k=ret; returnc!='\ n';} InlinevoidAddedge (intXintYintf) {e[++cnt].nxt=g[x];g[x]=cnt;e[cnt].to=y;e[cnt].f=F;} InlinevoidAdde (intXintYintf) {Addedge (x,y,f); Addedge (Y,x,0);} InlineBOOLBFsintu) {memset (DEP,0,sizeof(DEP)); Dep[u]=1; Q.push (U); while(!Q.empty ()) {u=Q.front (); Q.pop (); for(intI=g[u];i;i=e[i].nxt)if(e[i].f>0!Dep[e[i].to]) {Q.push (e[i].to); Dep[e[i].to]=dep

Bzoj1001 [BeiJing2006] Wolf catches rabbits

vertex is the in point, and the bottom-right corner is the out point (network flow splitting idea).Build edge to find the shortest possible.By the way, the two types of Dijkstra have been tested, and this version, which is not commented out, is about 200ms slower than the commented version, and it seems that the inq judgment of the large constant is more time consuming than the high-constant priority queue.1 /*by Silvern*/2#include 3#include 4#include 5#include 6#include 7#include 8#include 9 u

"HDU 5449" Robot Dog

son a father, and the father becoming a son, the conclusion is exactly the same, but the number of child nodes has changed.But d[i]=2* (N-siz[i])-1, and finally the read-in edge processing, each jump to the position of V to continueAnd then you'll find that the decimal is feint 23333Code#include using namespacestd;#defineN 100010#definell Long Longintt,n,m,q,cnt;intdep[n],f[n][ -],first[n];ll Up[n],down[n],siz[n];structemail{intu,v; intNXT;} E[n*4];inlinevoidAddintUintv) {e[++cnt].

[CF Round #278] Tourists

], buf1[buf_size];int cur, cur1;FILE *in, *out;FastIO () {Cur = buf_size, in = stdin, out = stdout;Cur1 = 0;}inline Char GetChar () {if (cur = = buf_size) fread (BUF, Buf_size, 1, in), cur = 0;return * (BUF + (cur++));}inline void Putchar (char ch) {* (Buf1 + (cur1++)) = ch;if (Cur1 = = buf_size) fwrite (BUF1, Buf_size, 1, out), Cur1 = 0;}inline int flush () {if (Cur1 > 0) fwrite (buf1, Cur1, 1, out);return cur1 = 0;}}io;#define GETCHAR Io.getchar#define PUTCHAR Io.putcharint read () {char ch =

Bzoj2730 [HNOI2012] Mine construction

attached to two cut points, one can not be from another to the other), the answer is tired by the conditions of the Unicom block points. ↑ input Data read in is the number of sides, silly as a point, read into the wrong, but also always check the problem of the algorithm ... ↑wa to fly after the anger to see the key, code to change and Tunix the basic same, only to find read into ... (Hope Day)1 /*by Silvern*/2#include 3#include 4#include 5#include 6#include 7#include 8 #defineLL unsigned long

Bzoj 1827 Big Cow Rally

Tree-type DP.#include #include#include#include#defineMAXV 200500#defineMaxe 300500#defineINF 1000000007using namespacestd;Long LongN,x,y,z,c[maxv],nume=0, g[maxv],val[maxv],sum=0, ANS,DIS[MAXV];structedge{Long LongV,W,NXT;} E[maxe];voidAddedge (Long LongULong LongVLong LongW) {e[++nume].v=v; E[NUME].W=W; E[NUME].NXT=G[u]; G[u]=Nume;}voidDFS1 (Long LongXLong LongFath) {Val[x]=C[x]; for(Long LongI=g[x];i;i=e

Bzoj 1015 Star Wars

The idea is actually very good to think: is backwards maintenance and check set.However? The details are super-large.First, each node can be attacked multiple times, just the one that started the attack.Second, consider the dependencies of a clear and checked set.#include #include #include #define Maxe 950050#define MAXV 950050using namespace Std;struct Edge{int v,nxt;}e[maxe];int G[MAXV],N,M,K,X,Y,NOW[MAXV],ANS[MAXV],CNT=0,NUME=0,FATHER[MAXV],FIRST[M

Bzoj 2243 Staining

Ah, this is a code editor. I just found out today.Chain water problem. Maintains the color of the interval left and right endpoints.#include #include#include#include#defineMAXV 200500#defineMaxe 200500#defineMAXN 805000using namespacestd;intn,m,num[maxv],x,y,root=1, nume=0, tot=0, cnt=0, G[MAXV];intDIS[MAXV],TOP[MAXV],FATH[MAXV],SIZE[MAXV],SON[MAXV],W[MAXV],FW[MAXV];intLS[MAXN],RS[MAXN],LPOS[MAXN],RPOS[MAXN],LAZY[MAXN],SUM[MAXN];inta,b,c;BOOLVIS[MAXV],FFF[MAXV];Chartype[5];structedge{intV,

Graph theory (the maximum weight independent point set of two graphs): COGS 2051. Sword of the King

following N rows M column is used to describe the number matrix"Output Format"How many value gems can be obtained from the output"Sample Input"2 21 22 1"Sample Output"4SourceYiu Jinyu's original problem, modified  You can find some details that you don't need to think about.The Hubo paper has a detailed answer to this question.1#include 2#include 3#include 4#include 5 using namespacestd;6 Const intmaxn=10010;7 Const intmaxm=800010;8 Const intinf=1000000000;9 intCNT,TOT,FIR[MAXN],FRON[MAXN],DIS[

cf893f subtree Minimum Query Chairman Tree

) Putchar (IW)TPR InlinevoidWrite (Ra o,Charc ='\ n') { if(!o) PC ('0'); if(O 0) o =-O, PC ('-'); while(o) wr[++ rw] = o%Ten, O/=Ten; while(rw) PC (WR[RW--] +'0'); PC (c); } TPR InlinevoidCmin (RA a, RA b) {if(A > B) a =b;} TPR InlinevoidCmax (RA a, RA b) {if(A b;} TPR InlineBOOLCkmin (RA a, RA b) {return(A > B)? A = B,1:0; } TPR InlineBOOLCkmax (RA a, RA b) {return(A 1:0; }}using namespacestd;using namespaceRemoon;#defineSid 300050#defineOID 12050000intDfn[sid], sz[sid];intN, R, M,

Travel of Coj 0346 Wzj (ii)

How much output meets the requirements of the city (S,t). Input example 5 3 61 2 32 3 33 4 24 5 1 Output example 6 Other Notes Cities to (2,3), (1,3), (2,4), (2,5), (3,5) meet the requirements, a total of 61111 The puzzle: Will write a point of treatment ...First of the complement set conversion, not the same subtree = total-in the same subtree, then is the path two paragraphs in the same

Thinking about the AHA algorithm and some code implementation

, the Moore operation must be performed on the array size and size. Until the loop goes to a [0]. If a [1] is not processed at last, put a [1] into temp to repeat the above process. Math can prove that the number of times used cyclically is gcd (size, I). The size is N in the description, and I is rotate from the I element. CodeWrite as follows: [CPP] View plaincopyprint? # Include TemplateTypenameT> VoidSwap (T A, T B) { T c =; A = B; B = C; } IntGcd

"Hdoj" 2388 Playground Hideout

Priority Queue Direct AC.1 /*2388*/2#include 3#include 4#include string>5#include 6#include 7#include Set>8#include 9#include Ten#include One#include A#include -#include -#include the#include -#include -#include -#include +#include -#include +#include A using namespacestd; at //#pragma COMMENT (linker, "/stack:102400000,1024000") - - #defineSTI set - #defineStpii Set - #defineMpii map - #defineVI vector in #definePII pair - #defineVpii vector to #defineRep (I, A, n) for (int i=a;i +

Total Pages: 15 1 .... 11 12 13 14 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.